command button code

slcollie

Registered User.
Local time
Today, 08:37
Joined
Jun 6, 2000
Messages
20
I have a form which has details of customer includins customer ID.

I want to be able to press print and another form to be printed out showing that particular customer record. (it is basically the same information, but in a different format).

So I set up a command button which prints the specific form that I want then I added stLinkCriteris specifiying Customer ID = Customer ID.

However, when pressed I get the error message 'Type mismatch' - what does this mean?

Would I be better using a report?
 
Did you check the "[" at strLinkCriteria?

Probably it should be like this:

strLinkCriteria="[Cutomer ID]=" & lngCustomerID

Only after setting "[" access will accept field-names including space(s).
 
here is the code that is bringing up the error message 'type mismatch'

private sub print_click()
On error goto err_print_click

dim stdocname as string
dim stlinkcriteria as string
stlinkcriteria = "[deceasedID]="& Me![DeceasedID]
stdocname = "track report"
docmd.printout stdocname,,,stlinkcriteria

exit print_click;
exit sub

err_print_click:
msgbox err.description
resume exit_print_click
end sub
 
The type mismatch may be coming from appending the Me!ID to the string - it may be in an integer or number format - if it is then you may have to change it to string format b4 appending.

also have u tried using a filter??

is this a report you are printing?

- Topher
 
If Me![DeceasedID] is a text field, it needs to be surrounded by single or double quotes.

stlinkcriteria = "[deceasedID]='"& Me![DeceasedID] & "'"
 

Users who are viewing this thread

Back
Top Bottom