Printing of report from a particular record to a particular record

Imranis

Registered User.
Local time
Today, 17:07
Joined
Sep 11, 2000
Messages
26
I wish to print a report from a form. The filed name is Vouchernumber and I wish to print the report from a particular vouchernumber to a particular vouchernumber in ascending order. For example from vno 35 to vno 85. I wish to create a print command button which may ask me from which vno to which vno I wish to present the report. I suppose I have to create a diallogue box form, if so what code is to be attached with the print command button. Thanks.
 
Here is what I would do.

Code for the OnClick Event:

'Assume voucher number is integer
dim intVariable as integer
dim intVariable2 as integer
dim strTemp as string

strTemp=inputbox("Enter Voucher Number to Start from")

'Check to see if entry is numeric
If isNumeric(strtemp) then
intVariable=strtemp
else
msgbox$("Not a valid entry")
exit sub
endif

'Repeat previous code to get voucher number to finish with use intVariable2

dim strReportName as string
dim strCriteria as string

strReportName="Your Report Name"
strCriteria="[voucher#] BETWEEN " & intVariable & " AND " & intVariable2 & ""

docmd.OpenReport(strReportName,strCriteria)

I hope I have all the syntax correct.
*Loves debugger help*

Regards,
Duane Barker
 
Mr. Barkar. Thanks for reply, but I still have not succeeded. I give hereunder the complete details: Form Name is 'Inventory' and report name is 'stikcer', unique field is voucherno like 'G03233' and then number goes on increasing by one digit like 'G03234'
The voucherno field is marked text in DB file of table. If it is possible please indicate complete code with all comma, quotation etc because I donot have any previous experience of Access and I am a new with this programme. Thanks.
 

Users who are viewing this thread

Back
Top Bottom