G
Guest
Hi!
I need help with the syntax of a Docmd.openform procedure
I want to open a form with 3 criteria
I am able to open it with 1 criterion at the time , but I can't get the
syntax right for concatenating the 3
here is my code (Sorry for some names in french...):
Private Sub Prime_Click()
On Error GoTo Err_Prime_Click
Dim message, msg, msg2, title As String
Dim stDocName As String
Dim stLinkCriteria, stLinkCriteria1, stLinkCriteria2 As String
msg = "Before entering a bonus, enter the employeeID"
title = "Error"
If Len(Trim(Nz(Me!Employé, ""))) <> 0 Then
stDocName = "Prime"
stLinkCriteria1 = "[DateTravail] = #" & Format$(Me!DateTravail,
"short date") & "#"
stLinkCriteria = "[Employé]=" & Me![Employé]
stLinkCriteria = "[CodeTravail]=" & Me![CodeTravail]
DoCmd.OpenForm stDocName, , , stLinkCriteria & stLinkCriteria1 &
stLinkCriteria2
Else
message = MsgBox(msg, vbExclamation, title)
Exit Sub
End If
Exit_Prime_Click:
Exit Sub
Err_Prime_Click:
MsgBox Err.Description
Resume Exit_Prime_Click
End Sub
-------------------------------------
The docmd part is wrong obviously.
Can someone please give me the syntax to write?
Thanks a lot
Louis Pat
I need help with the syntax of a Docmd.openform procedure
I want to open a form with 3 criteria
I am able to open it with 1 criterion at the time , but I can't get the
syntax right for concatenating the 3
here is my code (Sorry for some names in french...):
Private Sub Prime_Click()
On Error GoTo Err_Prime_Click
Dim message, msg, msg2, title As String
Dim stDocName As String
Dim stLinkCriteria, stLinkCriteria1, stLinkCriteria2 As String
msg = "Before entering a bonus, enter the employeeID"
title = "Error"
If Len(Trim(Nz(Me!Employé, ""))) <> 0 Then
stDocName = "Prime"
stLinkCriteria1 = "[DateTravail] = #" & Format$(Me!DateTravail,
"short date") & "#"
stLinkCriteria = "[Employé]=" & Me![Employé]
stLinkCriteria = "[CodeTravail]=" & Me![CodeTravail]
DoCmd.OpenForm stDocName, , , stLinkCriteria & stLinkCriteria1 &
stLinkCriteria2
Else
message = MsgBox(msg, vbExclamation, title)
Exit Sub
End If
Exit_Prime_Click:
Exit Sub
Err_Prime_Click:
MsgBox Err.Description
Resume Exit_Prime_Click
End Sub
-------------------------------------
The docmd part is wrong obviously.
Can someone please give me the syntax to write?
Thanks a lot
Louis Pat