1) create a new query
2) set one or more fields to sort
3) add a criteria and possibly a group by
4) view the SQL View
Duane Hookom
MS Access MVP
To: MS_Access_Professionals@yahoogroups.com
From: no_reply@yahoogroups.com
Date: Wed, 21 Sep 2011 22:04:17 +0000
Subject: [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) & "'")
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)
<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Tidak ada komentar:
Posting Komentar