G
Guest
After reading a number of posts on OpenArgs, it seem that there is some
problems with it but it seems everybody got their respective codes to work in
the end.
I couldn't however! What am I doing wrong?
In my switchboard I have two buttons that are used to open the same form,
but to do different things.
I need to pass a variable to the form, so that the form can behave
accordingly (change labels, hide certain objects etc.)
Behind my first button, the code reads:
DoCmd.OpenForm stDocName, , , "Complete = false", , , "State1"
the other calls
DoCmd.OpenForm stDocName, , , "Complete = true", , , "State2"
Now, in my form open routine, I need to setup the form accordingly, but my
OpenArgs values aren't passed!!!!
Private Sub Form_Open(Cancel As Integer)
Dim test As String
test = Me.OpenArgs
in my case, Me.OpenArgs is NULL, and produces an error on this statement!!
I then tried ommiting the OpenArgs variable and used (also in the open_form
sub) the following:
Select Case Me.Filter
Case "Complete = FALSE"
ToggleAndSetFilter.Visible = False
Case "Complete = TRUE"
ToggleAndSetFilter.Caption = "These records are completed"
ToggleAndSetFilter.ForeColor = 32768
End Select
For some reason, the value of Me.Filter is also not correct when the form is
opened, eventhough the correct records are shown. I assume the filter
arguement is passed later and not yet set when the OPEN FORM sub is called.
But then, why doesn't OpenArgs pass the variable?? Am I missing something
stupid?
problems with it but it seems everybody got their respective codes to work in
the end.
I couldn't however! What am I doing wrong?
In my switchboard I have two buttons that are used to open the same form,
but to do different things.
I need to pass a variable to the form, so that the form can behave
accordingly (change labels, hide certain objects etc.)
Behind my first button, the code reads:
DoCmd.OpenForm stDocName, , , "Complete = false", , , "State1"
the other calls
DoCmd.OpenForm stDocName, , , "Complete = true", , , "State2"
Now, in my form open routine, I need to setup the form accordingly, but my
OpenArgs values aren't passed!!!!
Private Sub Form_Open(Cancel As Integer)
Dim test As String
test = Me.OpenArgs
in my case, Me.OpenArgs is NULL, and produces an error on this statement!!
I then tried ommiting the OpenArgs variable and used (also in the open_form
sub) the following:
Select Case Me.Filter
Case "Complete = FALSE"
ToggleAndSetFilter.Visible = False
Case "Complete = TRUE"
ToggleAndSetFilter.Caption = "These records are completed"
ToggleAndSetFilter.ForeColor = 32768
End Select
For some reason, the value of Me.Filter is also not correct when the form is
opened, eventhough the correct records are shown. I assume the filter
arguement is passed later and not yet set when the OPEN FORM sub is called.
But then, why doesn't OpenArgs pass the variable?? Am I missing something
stupid?