I receive an error message Type mismatch

J

johansf

Who can help me??? I would appreciate this.
I'm trying to do a check on a table see below. But I get a Type mismatch
error on the And "[Primary contact]= true" Can someone help me with this?
the collum is a field where I reffer to.


Private Sub Command68_Click()
On Error GoTo Err_Command68_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Extra contacts"

stLinkCriteria = "[HD ID]=" & "'" & Me![HD ID] & "'" And "[Primary
contact]= true"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command68_Click:
Exit Sub

Err_Command68_Click:
MsgBox Err.Description
Resume Exit_Command68_Click
 
D

Douglas J. Steele

stLinkCriteria = "[HD ID]= '" & Me![HD ID] & "' And [Primary contact]= true"

Exagerated for clarity, that's

stLinkCriteria = "[HD ID]= ' " & Me![HD ID] & " ' And [Primary contact]=
true"
 
J

johansf

Thanks for the fast response. But still not working.
Let me explain what I want to do.

I have a table with details and lets say I have following records in it

HD ID Name Primare
UK jojo Yes or No tickbox
UK didi Yes or No tickbox
UK rere Yes or No tickbox
IST qsqs Yes or No tickbox

The tickboxes from the same HD ID only one of them can be YES the other are
always NO.

So what I try to do is I have a form that shows me the primary HD ID so with
tick box YES.
In that form I have a button to show the rest of them. So if I click that I
want to see the other names frm that HD ID but with the NO tickbox.


stLinkCriteria = "[HD ID]= '" & Me![HD ID] & "' And [Primary contact]= true"

Exagerated for clarity, that's

stLinkCriteria = "[HD ID]= ' " & Me![HD ID] & " ' And [Primary contact]=
true"
Who can help me??? I would appreciate this.
I'm trying to do a check on a table see below. But I get a Type mismatch
[quoted text clipped - 19 lines]
MsgBox Err.Description
Resume Exit_Command68_Click
 
D

Douglas J. Steele

If you want to see the ones which aren't the primary (i.e.: those where
primary contact is False), you should use = False, not = True in your
criteria.

However, if the name of the field in the table is Primare, that's the name
that should be in your criteria, not [Primary contact].

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


johansf said:
Thanks for the fast response. But still not working.
Let me explain what I want to do.

I have a table with details and lets say I have following records in it

HD ID Name Primare
UK jojo Yes or No tickbox
UK didi Yes or No tickbox
UK rere Yes or No tickbox
IST qsqs Yes or No tickbox

The tickboxes from the same HD ID only one of them can be YES the other
are
always NO.

So what I try to do is I have a form that shows me the primary HD ID so
with
tick box YES.
In that form I have a button to show the rest of them. So if I click that
I
want to see the other names frm that HD ID but with the NO tickbox.


stLinkCriteria = "[HD ID]= '" & Me![HD ID] & "' And [Primary contact]=
true"

Exagerated for clarity, that's

stLinkCriteria = "[HD ID]= ' " & Me![HD ID] & " ' And [Primary contact]=
true"
Who can help me??? I would appreciate this.
I'm trying to do a check on a table see below. But I get a Type mismatch
[quoted text clipped - 19 lines]
MsgBox Err.Description
Resume Exit_Command68_Click
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top