I've reached my wits end with this!! I'm trying VERY HARD to see if a record exists! With the query below, I want to know if the vendor First exists in a table called tblActiveVendor AND has a Contract for a given Year. The query is to be filtered by a Form called frmExtAgrmntSetUp using two fields called txtVendor which is a text field and txtYear which is a LongInteger. I then set this query as the recordsouce to a list box called lstLookUP. When I select a record that I know exists, why does this code say theat the list box is null when I can see the record?!?!?!?!
PLEASE HELP! I've wasted WAY TOO MUCH TIME on this!!
Dim strSQL As String
strSQL = "SELECT tblActiveVendors.[Vendor#]" & vbCrLf
strSQL = strSQL & " , tblAgreementHed.Year" & vbCrLf
strSQL = strSQL & " FROM tblActiveVendors " & vbCrLf
strSQL = strSQL & " INNER JOIN tblAgreementHed " & vbCrLf
strSQL = strSQL & " ON (tblActiveVendors.[Vendor#] = tblAgreementHed.[Vendor#]) " & vbCrLf
strSQL = strSQL & " AND (tblActiveVendors.Assignee = tblAgreementHed.Assignee)" & vbCrLf
strSQL = strSQL & " WHERE (((tblActiveVendors.[Vendor#])=[Forms]![frmExtAgrmntSetUp]![txtVendor]) " & vbCrLf
strSQL = strSQL & " AND ((tblAgreementHed.Year)=[Forms]![frmExtAgrmntSetUp]![txtYear]));"
Me.lstLookUp.RowSource = strSQL
If IsNull(lstLookUp) Then
MsgBox "help!!"
End If
PLEASE HELP! I've wasted WAY TOO MUCH TIME on this!!
Dim strSQL As String
strSQL = "SELECT tblActiveVendors.[Vendor#]" & vbCrLf
strSQL = strSQL & " , tblAgreementHed.Year" & vbCrLf
strSQL = strSQL & " FROM tblActiveVendors " & vbCrLf
strSQL = strSQL & " INNER JOIN tblAgreementHed " & vbCrLf
strSQL = strSQL & " ON (tblActiveVendors.[Vendor#] = tblAgreementHed.[Vendor#]) " & vbCrLf
strSQL = strSQL & " AND (tblActiveVendors.Assignee = tblAgreementHed.Assignee)" & vbCrLf
strSQL = strSQL & " WHERE (((tblActiveVendors.[Vendor#])=[Forms]![frmExtAgrmntSetUp]![txtVendor]) " & vbCrLf
strSQL = strSQL & " AND ((tblAgreementHed.Year)=[Forms]![frmExtAgrmntSetUp]![txtYear]));"
Me.lstLookUp.RowSource = strSQL
If IsNull(lstLookUp) Then
MsgBox "help!!"
End If