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!

DAO Recordset Object Manipulation - Access 2002 VBA

Status
Not open for further replies.

foodmandeuce

Technical User
Jul 24, 2003
2
US
I would soooo appreciate help from anyone who can provide it:

I am setting up a quasi-command line in an application, where the user enters a unique command in a text box on a form, the application then searches the table for the command, grabs the corresponding "form" field from the table, and then goes to the table. Both of my books say to do the same thing, and the code has not passed compiling yet. Here is my code:

Sub Commandline(lngCommandEntry As Long)

Dim rstTable As Recordset

rstTable = CurrentDb.OpenRecordset("9999_tblCommands", dbOpenTable)

rstTable.Index = "lngCommand"

rstTable.Seek "=", lngCommandEntry

DoCmd.OpenForm rstTable.strForm, , , ""

End Sub


PLEEEEEEEEZZZZ HELP!
 
Hi foodmandeuce

I only have 2000, but I think you need at least ..

Code:
Dim rstTable As
Code:
DAO.
Code:
Recordset
Code:
Set
Code:
 rstTable = CurrentDb.OpenRecordset("9999_tblCommands", dbOpenTable)

.. and maybe ..

Code:
Dim rstTable As DAO.Recordset
Code:
Dim db As DAO.Database
Set db = CurrentDb
Code:
Set rstTable =
Code:
db
Code:
.OpenRecordset("9999_tblCommands", dbOpenTable)

Enjoy,
Tony
 
Thanks for the help, Tony!

Actually, the variable type did need to be changed. Instead of changing it to DAO.Recordset though, I changed it to Object, and it worked - thank goodness.

I appreciate your help! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top