command problem

  • Thread starter Thread starter Walter
  • Start date Start date
W

Walter

Can someone tell me what is wrong with the following
command?
DoCmd.OpenForm("frmPlantingDetails", , , "PlantingID
=" & Me.PlantingID)

When I move the cursor to another line I get an
error "Expected =". I am trying to open a
form "frmPlantingDetails" as a subform to a
form "frmPlantings" with a command button. The PlantingID
control is on both forms. It is the primary key
for "frmPlantings".
Thanks in advance,
Walter
 
Try ...

DoCmd.OpenForm "frmPlantingDetails", , , "PlantingID
=" & Me.PlantingID

.... removing the parenthesis
 
Can someone tell me what is wrong with the following
command?
DoCmd.OpenForm("frmPlantingDetails", , , "PlantingID
=" & Me.PlantingID)

When I move the cursor to another line I get an
error "Expected =". I am trying to open a
form "frmPlantingDetails" as a subform to a
form "frmPlantings" with a command button. The PlantingID
control is on both forms. It is the primary key
for "frmPlantings".
Thanks in advance,
Walter

Remove the parenthesis.

DoCmd.OpenForm "frmPlantingDetails", , , "PlantingID =" &
Me.PlantingID

The expression should all be on one line.

If frmPlantingDetails is a subform for frmPlantings why isn't it
simply embedded as a sub form within frmPlantings and linked by the
PlantingID fields.
 
Back
Top