Trying to use Openargs to filter a form using a value from a Combobox on a different form - but i just dont get how it works.
This is what i have so far.
Main Form
The StLink Criteria pulls back the correct year.
Then on my open event on the form i wish to open i have this code.
The OpenArgs is showing as a Null Value - so produces the error "Invlaid Use of Null"
Please advise.
This is what i have so far.
Main Form
Code:
Private Sub BtnFobDespatches_Click()
On Error GoTo Handler
Dim Stlinkcriteria As String
WarningsOff
Stlinkcriteria = "Calender Year=" & Forms!Frmukmenu.CboxYear.Value
DoCmd.OpenForm "FrmUKFOBDespatches", acFormDS, , , , , Stlinkcriteria
WarningsOff
BtnErrors_Click_Exit:
Exit Sub
Handler:
MsgBox Error$
Resume BtnErrors_Click_Exit
End Sub
The StLink Criteria pulls back the correct year.
Then on my open event on the form i wish to open i have this code.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim CbYear As String
CbYear = Forms!Frmukmenu.OpenArgs
If Len(CbYear) > 0 Then
DoCmd.GoToControl "Calender Year"
DoCmd.FindRecord CbYear, , True, , True, , True
End If
End Sub
The OpenArgs is showing as a Null Value - so produces the error "Invlaid Use of Null"
Please advise.