Is there something special about passing the value of a check box?
When the box is unchecked (value 0) it appears to work fine.
However, when the box is checked (value -1) it cannot locate the records.
Any idea what I'm doing wrong?
If Len([BKLG] & "") > 2 And Len([SBKG] & "") < 3 And [PreScoped] = -1 Then
' Check for BKLG and Pre-scoped only
stLinkCriteria = "[BKLG]= '" & Me![BKLG] & "' And [PreScoped]= " &
Me![PreScoped] & ""
If DCount("Def", "QryFrmScpWr", stLinkCriteria) < 1 Then
Beep
MsgBox WrsMsg3004, vbInformation, WrsMsgBx2001
DoCmd.GoToControl "[BKLG]" ' Position
cursor in Backlog code (BKLG) Field
Exit Sub
End If
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Douglas J. Steele said:
stLinkBKLG = "[BKLG]=" & "'" & Forms!frmscoping![BKLG] & "' AND [XYZ]=" &
Forms!frmscoping![XYZ]
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Berny said:
Currently I'm using the following code:
Private Sub BtnAcquire_Click()
On Error GoTo Err_BtnAcquire_Click
Dim stDocName As String
Dim stLinkBKLG As String
stDocName = "Def_Scoping"
stLinkBKLG = "[BKLG]=" & "'" & Forms!frmscoping![BKLG] & "'"
DoCmd.OpenForm stDocName, , , stLinkBKLG
DoCmd.Close acForm, "frmscoping", acSaveNo
Exit_BtnAcquire_Click:
Exit Sub
Err_BtnAcquire_Click:
MsgBox Err.Description
Resume Exit_BtnAcquire_Click
End Sub
How would I add the multiple fields?
Sorry, I'm new at this
Thanks
Are you talking about the variable that gets declared by the code
wizard
when you want to open a form from a command button (say), so that you have
something like:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Form1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stLinkCriteria can be any valid WHERE clause, without the word WHERE,
so
yes, you can use multiple fields.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
"Berny" <BlancoB at MSN dot Com> wrote in message
Can anyone tell where I can get some information on the proper use and
options of 'stLinkCriteria'?
Can it you have multiple fields when using 'stLinkCriteria'?
Thanks