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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get link criteria to work. 1

Status
Not open for further replies.

HMJ

Technical User
Nov 29, 2002
58
US
I am trying to use a drop down menu list for users to select the type of training that they want to review information about. I am using the following code on a button called 'Preview':
Code:
Private Sub Preview_Click()
On Error GoTo Err_Preview_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Synopsis"
    stLinkCriteria = "[Class_Title]='" & Me![Combo2] & "'"
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    
Exit_Preview_Click:
    Exit Sub

Err_Preview_Click:
    MsgBox Err.Description
    Resume Exit_Preview_Click
    
End Sub
When I use this, I get an error message that says... "Data Type Mismatch in Criteria Expression"

I have used this code elsewhere with no problem, but can't get it to work here.

Any ideas?


Harry Jessen
HMJessen@Yahoo.com
 
Hi HMJ,

Silly question, but what datatype is Class_Title? It's not, perhaps, a numeric value with a lookup for text, is it?

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Tony:

OOPS. You hit that one with the first swing! Guess I am to close too the problem.

Now the next question - can I get around this situation? And if so, how?



Harry Jessen
HMJessen@Yahoo.com
 
Hi Harry,

How is your combo populated? Can you make it two columns - the first one zero width so the user can't see but with the numeric value equating to the text which can then go in your criteria (without quotes).

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Tony:

Sorry for the delay in responding. HAven't been to work in a few days.

You gave me the hint I needed. Thank You.

Harry Jessen
HMJessen@Yahoo.com
 
TONY:

What I did was change the way that I did the LinkCriteria part so that it was reading text versus numbers. I had this problem over 18 months ago and forgot all about it until I read your response.

Again, Thank You and a belated star for your help!!

Harry Jessen
HMJessen@Yahoo.com
 
My pleasure!

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top