D
D. Stacy
Have a form that allows the user to select a value from a combo box. The
combo box result is used as the criteria of a dlookup function.
The value created by the public function will be used in a series of
calculations throughout the application.
The function is returning the value of 1 every time, regardless of the user
selection.
Need help fixing this situation!
Current Code:
Private Sub Combo0_AfterUpdate()
Dim lCriteria As Long
lCriteria = Me!txtLocality_ID
FindGPCI_Work (lCriteria)
MsgBox "lCriteria equal to " & lCriteria, vbOKOnly
'MsgBox "CurrentWork_GPCI equal to " & CurrentWork_GPCI, vbOKOnly
End Sub
and.....
Public Function FindGPCI_Work(lCriteria As Long) As Long
' take tblGPCI.ID value from Form frmLocalitySelect
' lookup integer value in tblGPCI.Work_GPCI
Dim CurrentWork_GPCI As Long
CurrentWork_GPCI = DLookup("PE_GPCI", "tblGPCI", "[ID] = " & lCriteria &
"")
MsgBox "CurrentWork_GPCI equal to " & CurrentWork_GPCI, vbOKOnly
End Function
combo box result is used as the criteria of a dlookup function.
The value created by the public function will be used in a series of
calculations throughout the application.
The function is returning the value of 1 every time, regardless of the user
selection.
Need help fixing this situation!
Current Code:
Private Sub Combo0_AfterUpdate()
Dim lCriteria As Long
lCriteria = Me!txtLocality_ID
FindGPCI_Work (lCriteria)
MsgBox "lCriteria equal to " & lCriteria, vbOKOnly
'MsgBox "CurrentWork_GPCI equal to " & CurrentWork_GPCI, vbOKOnly
End Sub
and.....
Public Function FindGPCI_Work(lCriteria As Long) As Long
' take tblGPCI.ID value from Form frmLocalitySelect
' lookup integer value in tblGPCI.Work_GPCI
Dim CurrentWork_GPCI As Long
CurrentWork_GPCI = DLookup("PE_GPCI", "tblGPCI", "[ID] = " & lCriteria &
"")
MsgBox "CurrentWork_GPCI equal to " & CurrentWork_GPCI, vbOKOnly
End Function