Problem with opening subform

  • Thread starter Thread starter Skylar Andersen
  • Start date Start date
S

Skylar Andersen

I am still having problems with the following code:

Private Sub ChooseADoctor_Click()
On Error GoTo Err_ChooseADoctor_Click
'Open a subform containing all of the related shipping
addresses
Dim cs As Object
Set cs = Me.CustomerID
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders",
acFormDS, , CustomerID = cs

Exit_ChooseADoctor_Click:
Exit Sub

Err_ChooseADoctor_Click:
MsgBox Err.Description
Resume Exit_ChooseADoctor_Click

End Sub

When I choose a particular record by clicking a checkbox
in Form1, the "OnClick" event is supposed to use the
CustomerID field of Form1 and open all matching records
in Form2 where the CustomerID field of Form2 matches the
CustomerID field of Form1. When I run the code, I get the
following error: "Enter Parameter Value" for
Form1.CustomerID.

Any suggestions?

Thank you.
 
Maybe

Private Sub ChooseADoctor_Click()
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders", acFormDS, , _
"CustomerID = " & Me.CustomerID
End Sub

will work. Note that >"CustomerID = " & Me.CustomerID< will work only if
the ID is numeric. If it is alpha(numeric), use >"CustomerID = '" &
Me.CustomerID & "'"< instead.
Pavel
 
Pavel:

Same error. The change had no effect.

-----Original Message-----
Maybe

Private Sub ChooseADoctor_Click()
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders", acFormDS, , _
"CustomerID = " & Me.CustomerID
End Sub

will work. Note that >"CustomerID = " & Me.CustomerID< will work only if
the ID is numeric. If it is alpha(numeric), use
"CustomerID = '" &
Me.CustomerID & "'"< instead.
Pavel


.
 
Well, do you have a field called CustomerID in the record source of the
target form? The filter being passed to it can't seem to find it. Maybe
the name of the field is different or has a space in it?

Pavel
 
Back
Top