I have this bit of code that pulles up the query "ID answer" based on inputs the user gives. I wanted to open the first record on that list of "ID Answer." in a form view. I added the openform function but it does not work. It does not open the form. I was wondering if anyone had any suggestions.
Basically if the user inputs the name=Joe. The query finds all the records with the name joe. This part works. Now I want it to open up the form of the first record in that list.
With CurrentDb
.QueryDefs.Delete ("ID Answer")
Set qdfNew = .CreateQueryDef("ID Answer", query)
.Close
End With
DoCmd.OpenQuery "ID Answer", acNormal, acEdit
DoCmd.OpenForm "Form1", acNormal, , , , , "ID Answer"
End Sub
Basically if the user inputs the name=Joe. The query finds all the records with the name joe. This part works. Now I want it to open up the form of the first record in that list.
With CurrentDb
.QueryDefs.Delete ("ID Answer")
Set qdfNew = .CreateQueryDef("ID Answer", query)
.Close
End With
DoCmd.OpenQuery "ID Answer", acNormal, acEdit
DoCmd.OpenForm "Form1", acNormal, , , , , "ID Answer"
End Sub