help with command button
'DoCmd.OpenForm "frmPlantingDetails", , , "PlantingID
=" & Me!PlantingID
Is that an actual ' before the DoCmd.... function? If
that's actually there, you may want to take that out.
>I am trying to open a subform with a command button on the
>main form. I used the wizard to get the open form code.
>I then edited the code to link the forms with the common
>field. What I have is this:
>Private Sub cmdPlantingDetails_Click()
>On Error GoTo Err_cmdPlantingDetails_Click
> Dim stDocName As String
> Dim stLinkCriteria As String
> stDocName = "frmPlantingDetails"
> stLinkCriteria = "PlantingID=" & Me.PlantingID
> 'DoCmd.OpenForm "frmPlantingDetails", , , "PlantingID
>=" & Me!PlantingID
> Exit Sub
> MsgBox Err.Description
> Resume Exit_cmdPlantingDetails_Click
>I get an error message saying "expected =".
>When I add the "= " the prompt comes up showing OpenForm
>help highlighting "form name" at the beginning. I
>commented the 5 lines after "On Error Go To" and added
>DoCmd.OpenForm "frmPlantingDetails", , , "PlantingID =" &
>Me!PlantingID (this is commented now). This opened the
>subform but didn't link the two forms.
>The main form is named "frmPlantings" with "PlantingID" as
>the primary key. The subform is
>named "frmPlantingDetails" with "PlantingID" field as the
>foreign key. I am sure this is something simple that I am
>missing but I haven't been able to figure it out. Any
>help is appreciated greatly.
|Thread Tools||Search this Thread|