I have some code that generates a table(tblTempSearch) of existing values for a field(CCode). Now I want to open a form using the OpenForm method and in the where argument I want to specify only open records where CCode equals one of the generated values in tblTempSearch.
I tried it this way
Dim db As DAO.Database, rs As DAO.Recordset, fld As field
Set db = CurrentDb
Set rs = db.OpenRecordset("tblTempSearch"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set fld = rs.Fields("CCode"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
'Open the form frmCourses.
DoCmd.OpenForm "frmCourses", , , "CCode = fld"
but it doesn't work. I just get asked for the parameter fld.
Any ideas? Bearing in mind I REALLY can't use the filter instead in this case.
Cheers,
Pete
I tried it this way
Dim db As DAO.Database, rs As DAO.Recordset, fld As field
Set db = CurrentDb
Set rs = db.OpenRecordset("tblTempSearch"
Set fld = rs.Fields("CCode"
'Open the form frmCourses.
DoCmd.OpenForm "frmCourses", , , "CCode = fld"
but it doesn't work. I just get asked for the parameter fld.
Any ideas? Bearing in mind I REALLY can't use the filter instead in this case.
Cheers,
Pete