Figured it out.
Had to change:
stDocName = "Label"
stLinkCriteria = "[Key]=" & Me![Key]
DoCmd.OpenForm stDocName, , , stLinkCriteria
To:
stDocName = "Label"
stLinkCriteria = "[Key]=" & Me![Key]
DoCmd.OpenReport stDocName, , , stLinkCriteria
But this just automatically printed the report so I further changed the
coding to open the report in print preview allowing the user to review the
information. Here was the final coding I used.
stDocName = "Label"
stLinkCriteria = "[Key]=" & Me![Key]
DoCmd.OpenReport stDocName, acPreview , , stLinkCriteria
"NikkiB" wrote:
> I would like to use the information from this original email to open a
> Report(rather then a Form) from a Form after selecting record.
>
> The coding works if I create a Form named "Label" but I cannot figure out
> how to specify and open a Report named "Label".
>
> I have attached the VB code I'm using for your review. First I save the
> selected record and then I would like to open the report named "Label".
>
> Private Sub Save_Click()
> On Error GoTo Err_Save_Click
>
>
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "Label"
>
> stLinkCriteria = "[Key]=" & Me![Key]
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> Exit_Save_Click:
> Exit Sub
>
> Err_Save_Click:
> MsgBox Err.Description
> Resume Exit_Save_Click
> End Sub
>
> Sorry but I am brand new at using VB coding in Access.
>
> Thanks so much for any help,
>
> NikkiB
>
> "EddieZ" wrote:
>
> > How do I open a 2nd form after user selects a record on the 1st
> > form(datasheet view) The 2nd form contains more details Thanks for your help
|