Problem with coding

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

Skylar Andersen

I am trying to use a checkbox in a subform of customers
to open a second subform of shipping addresses.I am using
the following code in the "On click" event in the
checkbox:

'Open a subform containing all of the related shipping
addresses
Dim cs As TextBox
Set cs = CustomerID.Value
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders",
acFormDS, , CustomerID = cs

When I open the form and click a checkbox next to a
particular customer's name I get an "Object Required"
error.

I also lack the knowledge to cause the "Subform
ShipAddresses FrmNewOrders" to open as a subform within
the mainform.

Since I am a beginner/intermediate in coding, I need some
help please. Any help would be appreciated!

Thank you.
 
-----Original Message-----
I am trying to use a checkbox in a subform of customers
to open a second subform of shipping addresses.I am using
the following code in the "On click" event in the
checkbox:

'Open a subform containing all of the related shipping
addresses
Dim cs As TextBox
Set cs = CustomerID.Value
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders",
acFormDS, , CustomerID = cs

When I open the form and click a checkbox next to a
particular customer's name I get an "Object Required"
error.

I also lack the knowledge to cause the "Subform
ShipAddresses FrmNewOrders" to open as a subform within
the mainform.

Since I am a beginner/intermediate in coding, I need some
help please. Any help would be appreciated!

Thank you.
.
try just using this:
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders",
acFormDS, , "[CustomerID] = " me.CustomerID
 
I tried the suggested code. When I clicked in the
checkbox an "Enter Parameter" popup box opened waiting ro
me to fill in a CustomerID (I think). It is not seeing
the customerID in the table with the checkbox (Customers
table).

Any other suggestions?

Thank you.
-----Original Message-----
-----Original Message-----
I am trying to use a checkbox in a subform of customers
to open a second subform of shipping addresses.I am using
the following code in the "On click" event in the
checkbox:

'Open a subform containing all of the related shipping
addresses
Dim cs As TextBox
Set cs = CustomerID.Value
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders",
acFormDS, , CustomerID = cs

When I open the form and click a checkbox next to a
particular customer's name I get an "Object Required"
error.

I also lack the knowledge to cause the "Subform
ShipAddresses FrmNewOrders" to open as a subform within
the mainform.

Since I am a beginner/intermediate in coding, I need some
help please. Any help would be appreciated!

Thank you.
.
try just using this:
DoCmd.OpenForm "Subform ShipAddresses FrmNewOrders",
acFormDS, , "[CustomerID] = " me.CustomerID
.
 
Back
Top