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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set rstXXXX = OpenRecordset..etc code not working -HELP! 1

Status
Not open for further replies.

ClifCamp

Technical User
Jul 24, 2001
23
US
Can anyone tell me why the code hangs at the "set rstAdmin = OpenRecordset, etc. line with a Type Mismatch error? I have looked at examples and can't find the problem. Here is the code:

Private Sub Command2_Click()
Dim db As Database
Dim rstAdmin As Recordset
Dim PSID As String

' Value passed from open form
PSID = Forms!Form1!Text0

Set db = CurrentDb()
Set rstAdmin = db.OpenRecordset("tblAdmin", dbOpenDynaset)

rstAdmin.Find PSID, , adSearchForward

If IsMissing(PSID) Then MsgBox "Nope" _
Else: MsgBox PSID & " found"

End Sub

Thanks for any help!
 
Swap dbOpenDynaset for dbOpenTable,
dbOpenDynaset is more query based recordsets.
 
Did you check the syntax for this command in Access help? It has to be something like

OpenRecordset("SELECT * FROM tblAdmin")

Jim DeGeorge [wavey]
 
I don't see anything wrong with that line but try this:
Dim db As DAO.Database
Dim rstAdmin As DAO.Recordset

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
I'm pretty sure this has to do with your library references under tools menu. You are using DAO here so release any references to ADO you might have.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top