Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call(open) recordset from table for if test missing something

Status
Not open for further replies.

Tootie

MIS
May 31, 2001
2
US
I have code with if's testing for a letter and assigning a number to a const variable that is created. Can access 97 accept EOF? also how do I focus on the first record in a particular table to then start the looping process?
i.e.

Const qf1, qf2, qf3 as integer = 0
do until EOF
if f1 = "a" then
qf1=qf1+1
else
if f1 = "b" then
qf2=qf2+2
else
if f1 = "c" then
qf3=qf3+3
else
exit do
endif
endif
endif
loop

and so forth

 
look up "FindFirst" in the help file. you can use this to start with the first record in the recordset. EOF works great for looping through the code. Note: You need to make sure that the recordset contains at least one record before trying to access a record in the recordset, or it will cause an error. Use the DCount() function to count the records in the recordset, and use an "If VariableCount > 0 Then" run the code loop ELSE exit Sub.
 
that will get us going again we are still having the problem getting the
dim db as database
dim rst as recordset

to work. do we have to use the DAO stuff I have seen? do we have to use the db name? i.e.

dim dbname.db as database
dim dbname.rst as recordset?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top