Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

access recordset problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Reg - 24 Feb 2006 02:50 GMT
I have an access database with a table, tblNameList.
There are three columns in the table
        personID , name,  and email
There are three names entered in the table.
I can use this table to populate a list box successfully.
However when I try to open it as a recordset with the following code I
strike a problem.
 Dim rst As Recordset
 Dim db As Database
 Set db = CurrentDb()
        Set rst = db.OpenRecordset("SELECT * FROM tblNameList ")
       With rst
              If .RecordCount > 0 Then
                     txtBox =  .RecordCount
               End If
       End With

The value returned by .RecordCount is only one when it should be three.

I would be grateftul if someone can point to errors in the above code
or tell me where I should be looking to check for other possible errors.
Thanks
Reg
Jezebel - 24 Feb 2006 02:55 GMT
Absolutely the wrong forum to be asking this, but the problem is that the
RecordCount property isn't valid until the recordset is populated. You need
something like --

With rst

    'Move to the last record to populate the recordset (error if recordset
is empty)
    if not.eof then
       .movelast
   end if

   If .RecordCount > 0 Then
       txtBox =  .RecordCount
   End If
End With

>I have an access database with a table, tblNameList.
> There are three columns in the table
[quoted text clipped - 19 lines]
> Thanks
> Reg
Reg - 24 Feb 2006 03:43 GMT
Thanks for putting me on the right road Jezebel, despite the fact that in my
ignorance I could not find a more appropriate group on my isp's news server.
Reg

> Absolutely the wrong forum to be asking this, but the problem is that the
> RecordCount property isn't valid until the recordset is populated. You
[quoted text clipped - 36 lines]
>> Thanks
>> Reg
Doug Robbins - Word MVP - 24 Feb 2006 16:29 GMT
Point your newsreader to news.microsoft.com

1.1.    Connect to a newsgroup server using Outlook Express
Open Outlook Express and follow these steps:
1.      On the Tools menu, click Accounts.
2.      In the Internet Account dialog box, click Add, and then click News.
The Internet Connection Wizard starts. Follow these steps in the wizard:
1.      On the first screen, in the Display name box, type the name that
other users will see when you post a message to the newsgroup, and then
click Next.
2.      On the second screen, type your full e-mail address in the E-mail
address box, and then click Next.
3.      On the third screen, in the News (NNTP) Server box, type the name of
your news server. To subscribe to the newsgroups hosted on Microsoft's
servers, type msnews.microsoft.com. If you don't know the name of your news
server, contact your Internet provider.
4.      If necessary, select the My news server requires me to log on check
box, and then click Next. If you don't know whether your server requires you
to log on, contact your Internet provider. The Microsoft server does not
require a user name and password.
5.      On the last screen, click Finish.
3.      Click Close, and then click Yes when asked if you want to download
newsgroups from the account you just created. The Newsgroup Subscriptions
dialog box appears.
4.      Select the newsgroups you want to use, click Subscribe, and then
click OK.

Note   Most of Microsoft newsgroups use this naming convention:
microsoft.public.application_name.specific_area. For example: you could
subscribe to microsoft.public.office.dataanalyzer, or
microsoft.public.excel.programming. However, that isn't always the case.
Don't be afraid to browse the list of groups in order to find something that
you think will be useful.

5.      On the Tools menu, click Options, click the Read tab, and then clear
the Get 300 headers at a time check box.
6.      Click the Maintenance tab, clear the Delete new messages n days
after being downloaded check box, and then click OK.
Step 5 allows you to download and read all the newsgroup's postings when you
first subscribe. Step 6 allows you to read older messages.
1.2.    Subscribe or unsubscribe to newsgroups
After you establish a connection to your newsgroup server, you add
newsgroups to your list by subscribing. You can subscribe or unsubscribe to
newsgroups at any time. Typically, you use the group name as a guide when
subscribing. For example, a name such as
microsoft.public.office.developer.outlook.forms would be a good place to
start if you need help writing a custom form for Outlook.
To subscribe
1.      Start Outlook Express.
2.      In the folder pane, click the name of your news server. For example,
if you established a connection to Microsoft's server, click
msnews.microsoft.com.
3.      In the main viewing pane, click Newsgroups.
4.      In the Newsgroup Subscriptions dialog box, select a newsgroup from
the list, and then click Subscribe.
5.      Repeat the previous step to subscribe to additional newsgroups, and
then click OK when you finish.
6.      In the main viewing pane, double-click the name of the new
newsgroup. If you only want to receive new messages since the last time you
visited, select the New messages only check box, and then double-click the
newsgroup name.

Note   When you subscribe to a newsgroup for the first time, you receive all
the messages whether or not you select the New messages only check box.
To unsubscribe
In the Outlook Express folder pane, right-click the newsgroup that you want
to stop using, and then click Unsubscribe on the shortcut menu.
Tips
To reduce the number of items in the list of available newsgroups, enter a
phrase in the Display newsgroups which contain box. For instance, you can
enter an application name such as "publisher" or the name of a discipline
such as "programming." The list changes automatically when you finish
typing.
Newsgroups in languages other than English are identified by their names;
for example, microsoft.public.fr.excel is a newsgroup for Microsoft Excel
users who speak French.

Sorry, but there aren't any special groups for people that speak New
Zealand.
Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Thanks for putting me on the right road Jezebel, despite the fact that in
> my ignorance I could not find a more appropriate group on my isp's news
[quoted text clipped - 41 lines]
>>> Thanks
>>> Reg
Jezebel - 27 Feb 2006 11:05 GMT
> Sorry, but there aren't any special groups for people that speak New
Zealand.

Bitchy bitchy. Shove it up your schwa?
Doug Robbins - Word MVP - 27 Feb 2006 20:31 GMT
Jeeze, you read all that.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>> Sorry, but there aren't any special groups for people that speak New
> Zealand.
>
> Bitchy bitchy. Shove it up your schwa?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.