the following code works, no errors, but the query it creates doesn't open, instead, when opened it puts up a dialog box asking for a value. I am trying to tell it, in line 8, that the criteria value is the contents of a text box in the subform which contains the button that fires the code.
I numbered the lines for this message.
1.Private Sub Command13_Click()
2.Dim dbs As DAO.Database
3.Dim qdf As DAO.Querydef
4.Dim strSQL As String
5.Dim lkval As String
6.Dim jones As String
7.Set dbs = CurrentDb
8.lkval = PO_number.Value
9.jones = "poqry" & Str(Int(Now))
10.strSQL = "SELECT transaction_num, po_num, po_date FROM po_table WHERE po_num = lkval;"
11.Set qdf = dbs.CreateQueryDef(jones, strSQL)
I numbered the lines for this message.
1.Private Sub Command13_Click()
2.Dim dbs As DAO.Database
3.Dim qdf As DAO.Querydef
4.Dim strSQL As String
5.Dim lkval As String
6.Dim jones As String
7.Set dbs = CurrentDb
8.lkval = PO_number.Value
9.jones = "poqry" & Str(Int(Now))
10.strSQL = "SELECT transaction_num, po_num, po_date FROM po_table WHERE po_num = lkval;"
11.Set qdf = dbs.CreateQueryDef(jones, strSQL)