Problem with opening subform

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.
 
P

Pavel Romashkin

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
 
S

Skylar

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


.
 
P

Pavel Romashkin

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
 

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