Gregorys05
Board Regular
- Joined
- Sep 24, 2008
- Messages
- 217
Hi guys,
I have the below code but am getting a bit stuck.
Form1 is a normal form & form2 is a datasheet form
i think i know what the issue is but cannot find a VBA solution.
the forms load fine and the datasheet has the 4000 odd records but dosen't display any of the data, when i access form2 manually i have to add the Meter_Serial_Number field to the form first before it shows the data.
How would i do this with VBA.
The reason i want this is that i want to have one form and a sub form for all the querys i want to display in my DB this way i dont have stupid number of forms one for each report.
Thank you
I have the below code but am getting a bit stuck.
Form1 is a normal form & form2 is a datasheet form
i think i know what the issue is but cannot find a VBA solution.
the forms load fine and the datasheet has the 4000 odd records but dosen't display any of the data, when i access form2 manually i have to add the Meter_Serial_Number field to the form first before it shows the data.
How would i do this with VBA.
The reason i want this is that i want to have one form and a sub form for all the querys i want to display in my DB this way i dont have stupid number of forms one for each report.
Thank you
Code:
Private Sub cmdviewinByboxnotindhl_Click()
DoCmd.OpenForm "Form1", acNormal, "", "", , acNormal
Forms!form1.Form2.Form.RecordSource = "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.Form2.Form.Requery
Forms!form1.Form2.Form.Refresh
End Sub