need help with Access Database

Soldato
Joined
22 Mar 2009
Posts
7,754
Location
Cornwall
so, have been trying to setup a database, and its pretty much how I wanted it, but the reports function isn't working as I would like. I basically wanted to press the print button, which printed a single report, but instead it prints them all. Same with the email function, it emails all the reports not just the current one.
 
Soldato
OP
Joined
22 Mar 2009
Posts
7,754
Location
Cornwall
its ok think i have sorted it, miss typed my report name :banghead:

what I used was
Private Sub Job_Print_Click()
Dim strReportname As String
Dim strCriteria As String

strReportname = "Job Report"
strCriteria = "[CustomerID] = " & Me!CustomerID

DoCmd.OpenReport strReportname, acNormal, , strCriteria
End Sub

does that look right, seems to work when testing.

do have another quick question, is there an easy way to have a search box on a form where you type the customer id and it will jump to that?
 
Last edited:
Soldato
Joined
13 Jul 2009
Posts
7,175
Location
Llanelli
I use 'docmd.findrecord' to act as my search box. If the record doesn't exist it just does nothing, if it does exist however it'll jump to that record. Even partial entries work, so much better than having a search dialog.
 
Soldato
OP
Joined
22 Mar 2009
Posts
7,754
Location
Cornwall
I use 'docmd.findrecord' to act as my search box. If the record doesn't exist it just does nothing, if it does exist however it'll jump to that record. Even partial entries work, so much better than having a search dialog.

ok, will have a look into that. Managed to semi do it with the Combo Box, but for some reason it wont let me search by surname.
 
Soldato
Joined
13 Jul 2009
Posts
7,175
Location
Llanelli
I don't have the code to hand (it's at work) but you can tell it which field to search, where to start and such like. On most of my forms I have an Input box that comes up but I have also used a textbox that triggers the code on enter key press which is so much quicker.
 
Back
Top Bottom