VBA Access 2007 Parsing problem!

Joined
Nov 2, 2012
Messages
4
Reaction score
0
All, I am trying to parse in a value from a form into a SQL statement within the VBA of that same form after update of a field. I need help on how to set the variable within the SQL statement on the where condition. When I take the where condition out all together, I have no problem with the code, so, I feel confident that the problem lies with the way I am trying to add the variable. It is a number (integer) and is to be used to locate a specific record within the query. Any help would be great!
By the way, when I run this as noted, I am getting the
“Runtime error 3061, Too few parameters. Expected 1”
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSelect As String
Dim rst1 As String
Dim rst2 As String
Dim Str1 As Integer

Set db = CurrentDb
Str1 = Me.TempPriRevNew

strSelect = "SELECT Work_In_Process_Tbl.[Doc#], Work_In_Process_Tbl.[Revision_Level] FROM Work_In_Process_Tbl WHERE (((Work_In_Process_Tbl.Priority) = Str1))GROUP BY Work_In_Process_Tbl.[Doc#], Work_In_Process_Tbl.[Revision_Level];"

Debug.Print strSelect
Set rst = CurrentDb.OpenRecordset(strSelect)

Thanks,
Mike
 

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