Go Back   Talk Root - PC Hardware, Software and Web Development forums > System Administration > Database Servers > Access



Reply
 
LinkBack Thread Tools Search this Thread
  #1  
Old 02-18-2004, 03:46 PM
Larry
Guest
 
Posts: n/a
Default 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.

>-----Original Message-----
>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(stDocName,,,stLinkCriteria)
>
> 'DoCmd.OpenForm "frmPlantingDetails", , , "PlantingID
>=" & Me!PlantingID
>
>Exit_cmdPlantingDetails_Click:
> Exit Sub
>
>Err_cmdPlantingDetails_Click:
> MsgBox Err.Description
> Resume Exit_cmdPlantingDetails_Click
>
>End Sub
>
>After DoCmd.OpenForm(stDocName,,,stLinkCriteria)
>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.
>Thanks.
>Walter
>
>.
>

Reply With Quote
Reply

Bookmarks
Sponsored Links


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On


Sponsored Links


All times are GMT -7. The time now is 01:02 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0