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

parameter query and VBA

Status
Not open for further replies.

Ouch

Programmer
Jul 17, 2001
159
GB
Plese help...i'm tearing my hair out....

the query 'qry_rpt_General' is a parameter query that users 'Between [Forms]![print Bulletin]![Start_date] And [Forms]![print Bulletin]![End_date]' as its parameter,

if i run the query it works fine and gives me the correct result

when i execute the following code it gives an error, 'one or more parameters are missing'

if i take the parameter request out of the query the code runs fine....

any ideas why it doesn't pick up the parameters? (they are on a form and the form is open)

Dim rst As New ADODB.Recordset
Dim SQLstr As String
Set dbs = CurrentDb

SQLstr = "SELECT bibref_id, date_imput FROM qry_rpt_General"

rst.Open SQLstr, CurrentProject.Connection, adOpenDynamic, adLockOptimistic, adCmdText

intaccnum = 1000
rst.MoveFirst

Do Until rst.EOF
MsgBox (rst![bibref_id])

SQLstr = "UPDATE tblbibliog " & _
"SET accession_number = " & intaccnum & _
" WHERE bibref_id = " & rst![bibref_id]

MsgBox (SQLstr)

'dbs.Execute SQLstr

intaccnum = intaccnum + 1
rst.MoveNext

Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top