stLinkCriteria Help

I

Irene

i have a form which have a button to call open a form. but it will have a st
LinkCriteria which is in text form. my code is like that:

Private Sub Command21_Click()
On Error GoTo Err_Command21_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "f_material_out_main"
stLinkCriteria = "[matl_code]=" & "'" & Me![matl_code] & "'" And
"[DO_no]=" & "'" & Me![DO_no] & "'"
'stLinkCriteria1 = "[matl_code]=" & "'" & Me![matl_code] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command21_Click:
Exit Sub

Err_Command21_Click:
MsgBox Err.Description
Resume Exit_Command21_Click

End Sub

can somebody help me to modify? cos when i click the button, it was coming
out an error "type mismatch". where should i change?

thanks for help!
 
P

Paolo

Hi Irene,
this should work

stLinkCriteria = "[matl_code]='" & Me![matl_code] & "' And [DO_no]='" &
Me![DO_no] & "'"

HTH Paolo
 
I

Irene

hi Paolo,

thanks a lot. it really work! thanks so much!

Paolo said:
Hi Irene,
this should work

stLinkCriteria = "[matl_code]='" & Me![matl_code] & "' And [DO_no]='" &
Me![DO_no] & "'"

HTH Paolo

Irene said:
i have a form which have a button to call open a form. but it will have a st
LinkCriteria which is in text form. my code is like that:

Private Sub Command21_Click()
On Error GoTo Err_Command21_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "f_material_out_main"
stLinkCriteria = "[matl_code]=" & "'" & Me![matl_code] & "'" And
"[DO_no]=" & "'" & Me![DO_no] & "'"
'stLinkCriteria1 = "[matl_code]=" & "'" & Me![matl_code] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command21_Click:
Exit Sub

Err_Command21_Click:
MsgBox Err.Description
Resume Exit_Command21_Click

End Sub

can somebody help me to modify? cos when i click the button, it was coming
out an error "type mismatch". where should i change?

thanks for help!
 

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