Rabu, 21 September 2011

[MS_AccessPros] Adding OrderBy to sql in code AND necessity of "IsNothing" line

 

I'm baaack! So thankful for your help. Have two questions.

1. I found John's code for creating an IsNothing module and did so. But when I went to use it, nothing. When I deleted the "If Not IsNothing(Me.LastName) Then" line, the rest of the code executed. How necessary is that line?

2. I would like to order the select statement by last name. I entered it before the WHERE statement but must have done something wrong. I'm including the code that worked without the ORDERBY statement.

Thanks a million!
Connie

' Check for similar name
'If Not IsNothing(Me.LastName) Then
' Open a recordset to look for similar names
Set rst = DBEngine(0)(0).OpenRecordset( _
"SELECT LastName, FirstName, SpouseFN FROM " & _
"Contacts WHERE Soundex([LastName]) = '" & _
Soundex(Me.LastName) & "'")

__._,_.___
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