Changing Box properties from another form

G

Guest

Hi, i want to open a form from an already open form, storing a field in a
variable before the new form opens, i then want to use this stored value in
the newly opened form to select a box and set its visible property to false.
I posted a question on this last week and was given code which was verty
helpful. Except now when i use this code in the new context i recieve an
error message. "run-time error '2465' microsoft access can't find the field
'(variable contents)' referred to in your expression."
the code i am using is as follows.

Private Sub cmdS_Click()
Dim SW As String
SW = SC '(where SC is the field value from the original form)
DoCmd.OpenForm "frmSS", acNormal

If Me(SW).Visible = True Then
Me(SW).Visible = False
ElseIf Me(SW).Visible = False Then
Me(SW).Visible = True
Else
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top