deweysanchez
New member
- Local time
- Today, 12:13
- Joined
- Aug 10, 2009
- Messages
- 5
Hi
I am running a select query from VBA (i think) and would like to use the select query result as a variable for something else. This is what I have atm. FYI STAFFDept is a numerical value relating to the ID number in the DEPARTMENTTable.
Dim STAFFDept
Dim stDocName As String
Dim db As Database
Dim rs As Recordset
Dim qdf As QueryDef
STAFFDept = Me!Department
Set db = CurrentDb
Set qdf = db.QueryDefs("STAFFFormDEPTQuery")
qdf.Parameters("WHERE DEPARTMENTTable!ID") = STAFFDept
Set rs = qdf.OpenRecordset
So is there a way of checking if this is working? and a way of using the result for example to show it in a message box, or use it as a definition for something else.
I am running a select query from VBA (i think) and would like to use the select query result as a variable for something else. This is what I have atm. FYI STAFFDept is a numerical value relating to the ID number in the DEPARTMENTTable.
Dim STAFFDept
Dim stDocName As String
Dim db As Database
Dim rs As Recordset
Dim qdf As QueryDef
STAFFDept = Me!Department
Set db = CurrentDb
Set qdf = db.QueryDefs("STAFFFormDEPTQuery")
qdf.Parameters("WHERE DEPARTMENTTable!ID") = STAFFDept
Set rs = qdf.OpenRecordset
So is there a way of checking if this is working? and a way of using the result for example to show it in a message box, or use it as a definition for something else.