I would like a vb 6 form to have a command button that would generate an access report based on the dates entered in two textboxes. A beginning date and an ending date. Any input would be helpful. Thanks, aspvbwannab
To do this you need a very good understanding of Access and passing paramters.
I'll outline the steps.
1. Create an AutoExec macro in Access
2. Create a function in Access that is called from the above macro.
3. The function will get a command line parameter which has the two values in it. such as
/cmd Smith|Sally
Put a Pipe symbol in between the two paramters.
4. your Access function will get the command line like so
Infopassed = Command
then using "Instr" find the | pipe symbol and get the two values out using Left and right functions
PipeLocation = instr(1,Infopassed,"|"
ValuePassed1 = left(Infopassed,PipeLocation -1)
ValuePassed2 = right(Infopassed,len(Infopassed)-PipeLocation -1)
5. Then your first function will call two more functions that you will use in your reports query.
These 2 functions will basically get the values passed to them and just return the same thing
Example: of one
public function TheLastName (ValuePassed1)
TheLastName = ValuePassed1
end function
So in the query that drives your report
In the lastname field criteria have
=TheLastName
then the last line in your function calls your report.
Docmd.Openreport ....
DougP, MCP
dposton@universal1.com
Ask me how Bar-codes can help you be more productive.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.