How do I check what parameter value is being passed to a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am amending an Access database that I have taken responsibility for so I
dont know all the intricacies of how it was build. There is a form that has
a custom toolbar which includes a couple of buttons that appear to run
reports . The reports have as their source queries, which should take values
from this form, but when I push the button, I get a prompt to enter the
required parameter, instead of it passing the values through. Is there a way
of debugging this so that I can see what is going on?
Thanks
 
Open the query in design view and ensure that the form controls referenced in
the parameters actually exist on the form. Try posting a specific example. It
should look like [Forms]![YourForm]![ControlName] in the query.
 
Brian,
Yes it does look like that. Specifically in SQL view the query looks like:

SELECT Tblrequests.ID,
TblTelcoInfo.[Telco CLI],
TblTelcoInfo.[Telco Details],
Tblrequests.Ref,
Tblrequests.TheirRef,
[Tblrequests].DateReceived AS Expr1,
[Tblrequests].DateReturned AS Expr2
FROM TblTelcoInfo
LEFT JOIN Tblrequests ON TblTelcoInfo.[Telco CLI] = Tblrequests.TelcoCLI
WHERE (((Tblrequests.ID)=[Forms]![frmRequests]![ID]));

Now as I read this I realise that it is prompting for the DateReceived and
DateReturned values, which it should not do, it should take those values from
the ID passed through from the frmRequests ID field.
This is very strange.



Brian said:
Open the query in design view and ensure that the form controls referenced in
the parameters actually exist on the form. Try posting a specific example. It
should look like [Forms]![YourForm]![ControlName] in the query.

Peter Clancy said:
I am amending an Access database that I have taken responsibility for so I
dont know all the intricacies of how it was build. There is a form that has
a custom toolbar which includes a couple of buttons that appear to run
reports . The reports have as their source queries, which should take values
from this form, but when I push the button, I get a prompt to enter the
required parameter, instead of it passing the values through. Is there a way
of debugging this so that I can see what is going on?
Thanks
 
Notice that the square brackets are around the Tblrequests only before the
two date field references and that both are showing up as Expr1/Expr2. I'mo
not sure here without testing, but I think the square brackets may be
indicating to the system that the contents are the name of a parameter and
not the table name. The other square brackets (on field names) are necessary
because of the spaces in the field names.

Try this instead:

SELECT Tblrequests.ID,
TblTelcoInfo.[Telco CLI],
TblTelcoInfo.[Telco Details],
Tblrequests.Ref,
Tblrequests.TheirRef,
Tblrequests.DateReceived,
Tblrequests.DateReturned
FROM TblTelcoInfo
LEFT JOIN Tblrequests ON TblTelcoInfo.[Telco CLI] = Tblrequests.TelcoCLI
WHERE (((Tblrequests.ID)=[Forms]![frmRequests]![ID]));

Peter Clancy said:
Brian,
Yes it does look like that. Specifically in SQL view the query looks like:

SELECT Tblrequests.ID,
TblTelcoInfo.[Telco CLI],
TblTelcoInfo.[Telco Details],
Tblrequests.Ref,
Tblrequests.TheirRef,
[Tblrequests].DateReceived AS Expr1,
1> [Tblrequests].DateReturned AS Expr2
FROM TblTelcoInfo
LEFT JOIN Tblrequests ON TblTelcoInfo.[Telco CLI] = Tblrequests.TelcoCLI
WHERE (((Tblrequests.ID)=[Forms]![frmRequests]![ID]));

Now as I read this I realise that it is prompting for the DateReceived and
DateReturned values, which it should not do, it should take those values from
the ID passed through from the frmRequests ID field.
This is very strange.



Brian said:
Open the query in design view and ensure that the form controls referenced in
the parameters actually exist on the form. Try posting a specific example. It
should look like [Forms]![YourForm]![ControlName] in the query.

Peter Clancy said:
I am amending an Access database that I have taken responsibility for so I
dont know all the intricacies of how it was build. There is a form that has
a custom toolbar which includes a couple of buttons that appear to run
reports . The reports have as their source queries, which should take values
from this form, but when I push the button, I get a prompt to enter the
required parameter, instead of it passing the values through. Is there a way
of debugging this so that I can see what is going on?
Thanks
 
Back
Top