Access form/report/query question
-
Access form/report/query question
I have a form that prints/previews reports from the database. Currently these reports are all based on queries set up at design time.
I want the user to be able to specify the query attributes from the form along with attributes specified by VB code (e.g. date from / to, part number etc) and produce a report based on this query at run time. How can this be done?
P.s. I'm using access 97
Tony
-
Erm, not sure about the VB code bit but I can tell you that, if you enter a Criteria into your query as a field name and it can't find that field, then it will prompt the user to specify the value at run time. For example, in a query retrieving customer details, you might have a field called CompanyName. In the Criteria row for this field, you wouldn't specify an actual value but, instead, you would enter [Client] or something similar. Because there's no field called Client, the query can't work out what you mean so it prompts you to enter a value by popping up a nice input box. Standard Access 97 stuff - works straight out of the box 
If your techy enough to write VB code, then I'm sure you could work out how to apply a similar principle into your code module as well
As long as you can get the principle of what you want to do (or the function name, etc), then you'll probably find the exact answer in Microsoft Access Help (as long as you've got the Visual Basic For Applications Help component installed as well).
Hope that helps 
P.S. I'm going to move this thread to a more appropriate board on the forum for you. Maybe someone there will have the full answer for the VB bit as well
-
I can write VB fine - it's just the first time involving a form in an Access database. Anyway Access help has sorted the problem - the syntax of the report load function was wrong (the SQL statement at the end specifying restrictions on the query)