Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: get rid of 'enter parameter value'


Message #1 by "ivan matema" <ivanmatema@m...> on Fri, 27 Sep 2002 08:28:05
i have a command button. when i click it, 2 dates(date format) are 
retrieved from 2 textboxes respectively, on a form. with these, i want to 
primt a report, with records whose date fields are found in the range 
given by the 2 dates.
it works fine, but what i want to get rid of is the prompt from access 
to "enter parameter vale". i end up re-typing the 2 dates again.
SOS!!!!!!!!!
Message #2 by "Gregory Serrano" <SerranoG@m...> on Fri, 27 Sep 2002 13:21:53
Ivan,

<< i have a command button. when i click it, 2 dates(date format) are 
retrieved from 2 textboxes respectively, on a form. with these, i want to 
primt a report, with records whose date fields are found in the range 
given by the 2 dates.

it works fine, but what i want to get rid of is the prompt from access 
to "enter parameter vale". i end up re-typing the 2 dates again. >>

If the record source for the report is a query, check the parameters in 
the query very carefully.  You may have specified variables in there that 
do not appear in the data itself.  Make sure all the variables in the 
query exist in the underlying table.

With that checked, your command button should have "On Click" code that 
looks something like this:

    Dim strDocName As String, strLinkCriteria As String

    strDocName = "rptMyReportName"
    strLinkCriteria = "[dtmDate1] >= #" & Me.txtDate1 & _
                      "# And [dtmDate2] <= #" & Me.txtDate2 & "#"
    DoCmd.OpenReport strDocName, acViewPreview, , strLinkCriteria


Greg
Message #3 by "Daniel Bailey" <maxim_ize@h...> on Fri, 27 Sep 2002 20:05:12

What is happening is that the form closes before the report has run so the 
paramenters aren't being passed from the form to the report so the report 
ask for the parameters again. A quick fix is to place:

Me.Visible = False 

in the on_click event of the command button before the report is opened.

This keeps the form open but not visible so your report can get the 
parameters. 

I call this is quick fix because it is sloppy coding since the form stays 
open until you close Access, but my client likes it because he can call 
the form up again and the parameters from the prior request are still 
there. 

Go figure, the client is always right!

Good luck,
Dan


I have a command button on a form. When I click it, 2 dates(date format) 
are retrieved from 2 textboxes respectively, on the form. With these 
paramaters I want to print a report, using those date fields are found on 
the form. It works fine, but what I want to get rid of is the prompt from 
access 
t> o "enter parameter vale". i end up re-typing the 2 dates again.
S> OS!!!!!!!!!

  Return to Index