E
Ernst Guckel
Hey,
I have a main form 'frmStartup' with a subform 'cldMain' that I change the
recordsource of via code depending on which command button the user chooses...
cldMain when the Orders button is chosen changes the source to
'frmInventorybyOrders' which has two sub forms on it - cldInventoryItems
and cldInventory.
In the on Current event of the InventoryItems form I run code that
requeries the Inventory form but applies a filter as well... The code runs
fine when the form is loaded and changes but when it is opened for the first
time I recieve an error...
The error is: You entered an expression that has an invalid reference to the
property Form/Report.
Here is the code
Dim sStart As String
Dim sStop As String
sStart = Format(Me.Parent![txtStart] - 1, "\#mm/dd/yyyy\#")
sStop = Format(Me.Parent![txtStop] + 1, "\#mm/dd/yyyy\#")
On Error Resume Next
sFilter = "tblInventory.InvDate > " & sStart & " AND tblInventory.InvDate <
" & sStop
If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Forms!frmStartup!cldMain.Form!cldInventory.Form.Filter = sFilter
Forms!frmStartup!cldMain.Form!cldInventory.Form.FilterOn = True
Me.Parent![cldInventory].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit
Forms!frmStartup!cldMain.Form!cldInventory.Form.Filter = sFilter is the line
that causes the error...
I just don't get it.. ANy help would be great...
Thanks,
Ernst.
I have a main form 'frmStartup' with a subform 'cldMain' that I change the
recordsource of via code depending on which command button the user chooses...
cldMain when the Orders button is chosen changes the source to
'frmInventorybyOrders' which has two sub forms on it - cldInventoryItems
and cldInventory.
In the on Current event of the InventoryItems form I run code that
requeries the Inventory form but applies a filter as well... The code runs
fine when the form is loaded and changes but when it is opened for the first
time I recieve an error...
The error is: You entered an expression that has an invalid reference to the
property Form/Report.
Here is the code
Dim sStart As String
Dim sStop As String
sStart = Format(Me.Parent![txtStart] - 1, "\#mm/dd/yyyy\#")
sStop = Format(Me.Parent![txtStop] + 1, "\#mm/dd/yyyy\#")
On Error Resume Next
sFilter = "tblInventory.InvDate > " & sStart & " AND tblInventory.InvDate <
" & sStop
If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Forms!frmStartup!cldMain.Form!cldInventory.Form.Filter = sFilter
Forms!frmStartup!cldMain.Form!cldInventory.Form.FilterOn = True
Me.Parent![cldInventory].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit
Forms!frmStartup!cldMain.Form!cldInventory.Form.Filter = sFilter is the line
that causes the error...
I just don't get it.. ANy help would be great...
Thanks,
Ernst.