Hey guys,
here is the deal. I am opening a report from a form (tab control type of
form) that has a combo box with a list of Airport codes (station).
here is the code:
Dim stDocName As String
Dim stLinkCriteria As String
Dim stValue As String
stDocName = "rpt_StnRecord"
stValue = Me![Combo12]
stLinkCriteria = "[Station]=" & stValue
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
As you can see, the report (rpt_StnRecord) is supposed to open using as
Station (field) criteria the value in the Combo12 (located on the tab form).
This works well except that I cannot get the report to open right away. I get
another box popping up asking me to enter the station value (which is already
in combo12).
I dont get it. Any idea?
Thanks guys.
Alec
Eric D - 08 Sep 2005 14:48 GMT
Change the Me![Combo12] to Forms![YourFormName].[Combo12]
I believe that because you are using Me![Combo12] and opening a report, the
report gets the focus and looks for Me![Combo12]... which it can't find.
Bottom line... never use Me![FieldName] when passing variables.
>Hey guys,
>here is the deal. I am opening a report from a form (tab control type of
[quoted text clipped - 18 lines]
>Thanks guys.
>Alec
Alec - 08 Sep 2005 15:09 GMT
I just tried and it does not work. I still a little pop up window where I
have to enter the value.
Any other suggestions?
Thanks for your help.
> Change the Me![Combo12] to Forms![YourFormName].[Combo12]
>
[quoted text clipped - 24 lines]
> >Thanks guys.
> >Alec