Hi
i have a query created with designed view, i changed the view to SQL view and used in VBA code i get this error
why is this happens please?
convert query to sql issue?
-
- BronzeLounger
- Posts: 1268
- Joined: 01 May 2016, 09:58
convert query to sql issue?
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: convert query to sql issue?
You cannot refer to controls on forms when you use DAO. You can get around this by concatenating the value of the combo box into the SQL string: change
... tblSection_District_List.LocationID_FK = [Forms]![frmSummary]![cboLocation]) ...
to
... tblSection_District_List.LocationID_FK = " & [Forms]![frmSummary]![cboLocation] & ") ...
If you call this code from frmSummary, you can even use
... tblSection_District_List.LocationID_FK = " & Me![cboLocation] & ") ...
... tblSection_District_List.LocationID_FK = [Forms]![frmSummary]![cboLocation]) ...
to
... tblSection_District_List.LocationID_FK = " & [Forms]![frmSummary]![cboLocation] & ") ...
If you call this code from frmSummary, you can even use
... tblSection_District_List.LocationID_FK = " & Me![cboLocation] & ") ...
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1268
- Joined: 01 May 2016, 09:58