Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report based on dates on vb form 1

Status
Not open for further replies.

VBVines

MIS
Jun 11, 1999
98
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top