Rabu, 28 September 2011

[MS_AccessPros] Strange happenings???

 

Hi again,

I have a txtbox "InfoSheetLine" on the form "Listings". Upon entering it if it is null or "" I would like to populate it with a string created from the telephone numbers and names for the contacts. It will then be changed by the user as appropriate. The code I have results in an error "Invalid Use of Null". The line in code that is highlighted upon debugging is strI = DLookup ...

Thanks! Code, SQLs below
Connie

Code on Enter:

'Create the initial infosheet line that can then be altered
Dim strI As String
If ((IsNull(Me.TelCombo)) Or (Me.TelCombo = "")) Then
strI = DLookup("InfoSheetLine", "qListingsInfoSheetLine", "ListID = " & Me.ListID)
Me.TelCombo.Value = strI
End If

The SQL "qNamNbrTyp" that creates the info that is concated in the next query is:
SELECT ListingContacts.ListID, [FirstName] & " " & [Abbrev] & " " & [ContactInfo] AS NamNbrTyp
FROM Contacts INNER JOIN ((Contact_PhoneEm INNER JOIN ListingContacts ON Contact_PhoneEm.ContactID = ListingContacts.ContactID) INNER JOIN ContactType_List ON Contact_PhoneEm.ContactTypeID = ContactType_List.ContactTypeID) ON Contacts.ContactID = Contact_PhoneEm.ContactID
WHERE (((ContactType_List.ContactType) Like '*phone*'));

The SQL for qInfoSheetListing where ConcatRelated is used:
SELECT Listings.ListID, ConcatRelated("NamNbrTyp","qListingsNamNbrTyp","ListID = " & [Listings].[ListID]) AS InfoSheetLine
FROM Listings
WHERE (((Listings.CurrentListing)=-1) AND ((Listings.ListingAgency)=1));


__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar