view query data in subform

Gregorys05

Board Regular
Joined
Sep 24, 2008
Messages
217
hi i have the below code, and i am trying to set a subform to display the results of a query.
But i keep getting the error "The expression you entered refers to an object that is closed or doesn't exist

any ideas


Code:
Private Sub cmdviewinByboxnotindhl_Click()
DoCmd.OpenForm "Form1", acNormal, "", "", , acNormal
SQL = "SELECT TblBybox_Returns_CSV.Meter_Serial_Number" & _
" FROM TblBybox_Returns_CSV LEFT JOIN TblDHL_Returns_CSV ON TblBybox_Returns_CSV.Meter_Serial_Number = TblDHL_Returns_CSV.Mtr_Serial_Number" & _
" WHERE (((TblDHL_Returns_CSV.Mtr_Serial_Number) Is Null));"

Forms![Form1]![Child3].Form.RecordSource = SQL
Forms![Form1]![Child3].Form.Requery

End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,216,180
Messages
6,129,352
Members
449,506
Latest member
nomvula

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top