I am doing an Access project as a newbie and i am facing some problems (have to do all in VBA). In few words i have to show a query results on a form. I have few text boxes and i need to show some info. I understood that i have to change the RecordSource to the form and that i have to set the RecordSet for each text-box. Here is my code but is not working:
Private Sub Form_open(Cancel As Integer)
Dim strSQL As String, queryDef As DAO.queryDef
strSQL = " *SELECT etc...* "
CurrentDb.QueryDefs.Delete "Info"
Set queryDef = CurrentDb.CreateQueryDef("Info", strSQL)
Me.RecordSource = queryDef.OpenRecordset() '**error here type mismatch
How can i change my RecordSource to a query that is created when open the form?
(Tried already with Me.RecordSet = strSQL but is not working with INNER JOIN)
Thank you a lot!
Me.Form.RecordSet = queryDef.OpenRecordset().