Printing Specific Record From a Report - Access 2007 (1 Viewer)

franckh2

Registered User.
Local time
Today, 01:32
Joined
Jan 15, 2013
Messages
12
Hi, I'm working on a database for my job and have a very limited understanding of code as I don't have much time to learn it in detail - I only need it for a few small things. Thus far I've been able to muddle my way through, but I'm stuck on trying to print off a specfic entry in a report. I found some threads on it but the code doesn't work. So basically I have client information on a form, and I want to be able to click a button and have it print the report on that specific record, not every one.

Here's the code I found online:

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere

When I put my info in it looks like this:

Dim strDocName As String
Dim strWhere As String
strDocName = "Face Sheets"
strWhere = "[ETO Number]=" & me![ETO Number]
DoCmd.OpenReport strDocName, acPreview, , strWhere

When I try and run it I get "run-time error 3464, data type mismatch in criteria expression".

Any ideas?

Thanks

-H
 

franckh2

Registered User.
Local time
Today, 01:32
Joined
Jan 15, 2013
Messages
12
Hi, thanks - the data type is a number. Some of the fields are blank - would that change it?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:32
Joined
Aug 30, 2003
Messages
36,118
Blank fields shouldn't matter, unless this field is blank. Can you post the db here?
 

franckh2

Registered User.
Local time
Today, 01:32
Joined
Jan 15, 2013
Messages
12
Here's the basic layout of it, I've changed the actual records because it's all confidential information. The form I'm trying to adapt is "Participant Details" and currently am trying to program the button right of the drop down selection to open the "face sheet" report.

Thanks

Heidi
 

Attachments

  • Info.accdb
    968 KB · Views: 154

pbaldy

Wino Moderator
Staff member
Local time
Today, 00:32
Joined
Aug 30, 2003
Messages
36,118
It's the data type of the field that matters. Yours is text, even though it contains numbers. Try:

strWhere = "[ETO Number]='" & Me![ETO Number] & "'"
 

franckh2

Registered User.
Local time
Today, 01:32
Joined
Jan 15, 2013
Messages
12
Well, I did this over and over again without success and then randomly I did it again and it worked. No idea what changed!

Thank you so much for your assistance and patience, this is immensely helpful for me!

H
 

Users who are viewing this thread

Top Bottom