accessing data w/vba

  • Thread starter flintridgeparkenfarker vonkerschnauzerheiden III \
  • Start date
F

flintridgeparkenfarker vonkerschnauzerheiden III \

Hi,

When I loop through all the records of a table using rs.movefirst, then
rs.movenext in a Do loop, the first record returned is ID #15, midway
through the table. Then when the last record is returned, rs.movenext moves
to the first record of the table and increments up to #14.

How can I *know* which record this thing is going to access on any given
statement?

Also, some fields have no entry. So if I attempt to skip these by testing
for a null value, nothing is returned. Not even the records with values.
I've tried 2 strategies to test for null.

if rs!Date <> null then

....and...

if not rs!Date is null then

....of course I didn't think the last statement would work correctly because
I'm testing for an object [I don't think].

At any rate, I'm new to coding Access and would appreciate any help. Thanks.

joe

--
/*~~~~~~~~~~^/\^~~~~~~~~~~~
*
* To be or not to be - Shakespeare
* To do is to be. - Kant
* To be is to do. - Sartre
* Do be do be do. - Sinatra
* Yabba dabba do! - Fred Flintstone
*
*~~~~~~~~~~^\/^~~~~~~~~~~~
*/
 
J

John Vinson

Hi,

When I loop through all the records of a table using rs.movefirst, then
rs.movenext in a Do loop, the first record returned is ID #15, midway
through the table. Then when the last record is returned, rs.movenext moves
to the first record of the table and increments up to #14.

How can I *know* which record this thing is going to access on any given
statement?

You can't. A Table HAS NO ORDER; the order of records in the recordset
is arbitrary. There are no record numbers. If you want to sort the
records by a field in the table (ID for instance), use a Query rather
than the Table as the source of the recordset.
Also, some fields have no entry. So if I attempt to skip these by testing
for a null value, nothing is returned. Not even the records with values.
I've tried 2 strategies to test for null.

if rs!Date <> null then

...and...

if not rs!Date is null then

Use instead

If Not IsNull(rs!Date) Then
 
F

flintridgeparkenfarker vonkerschnauzerheiden III \

Your responses should get me going again. Thanks.

joe


"flintridgeparkenfarker vonkerschnauzerheiden III (joe)" <[email protected]>
wrote in message : Hi,
:
: When I loop through all the records of a table using rs.movefirst, then
: rs.movenext in a Do loop, the first record returned is ID #15, midway
: through the table. Then when the last record is returned, rs.movenext
moves
: to the first record of the table and increments up to #14.
:
: How can I *know* which record this thing is going to access on any given
: statement?
:
: Also, some fields have no entry. So if I attempt to skip these by testing
: for a null value, nothing is returned. Not even the records with values.
: I've tried 2 strategies to test for null.
:
: if rs!Date <> null then
:
: ...and...
:
: if not rs!Date is null then
:
: ...of course I didn't think the last statement would work correctly
because
: I'm testing for an object [I don't think].
:
: At any rate, I'm new to coding Access and would appreciate any help.
Thanks.
:
: joe
:
: --
: /*~~~~~~~~~~^/\^~~~~~~~~~~~
: *
: * To be or not to be - Shakespeare
: * To do is to be. - Kant
: * To be is to do. - Sartre
: * Do be do be do. - Sinatra
: * Yabba dabba do! - Fred Flintstone
: *
: *~~~~~~~~~~^\/^~~~~~~~~~~~
: */
:
:
:
 
B

Bob Barnes

You're welcome - Bob
-----Original Message-----
Your responses should get me going again. Thanks.

joe


"flintridgeparkenfarker vonkerschnauzerheiden III (joe)"
wrote in message : Hi,
:
: When I loop through all the records of a table using rs.movefirst, then
: rs.movenext in a Do loop, the first record returned is ID #15, midway
: through the table. Then when the last record is returned, rs.movenext
moves
: to the first record of the table and increments up to #14.
:
: How can I *know* which record this thing is going to access on any given
: statement?
:
: Also, some fields have no entry. So if I attempt to skip these by testing
: for a null value, nothing is returned. Not even the records with values.
: I've tried 2 strategies to test for null.
:
: if rs!Date <> null then
:
: ...and...
:
: if not rs!Date is null then
:
: ...of course I didn't think the last statement would work correctly
because
: I'm testing for an object [I don't think].
:
: At any rate, I'm new to coding Access and would appreciate any help.
Thanks.
:
: joe
:
: --
: /*~~~~~~~~~~^/\^~~~~~~~~~~~
: *
: * To be or not to be - Shakespeare
: * To do is to be. - Kant
: * To be is to do. - Sartre
: * Do be do be do. - Sinatra
: * Yabba dabba do! - Fred Flintstone
: *
: *~~~~~~~~~~^\/^~~~~~~~~~~~
: */
:
:
:


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top