Hi.  I have an Access 97 query shown here:

SELECT SaleComps.*
FROM SaleComps
WHERE (((SaleComps.City) Like [Enter City] & "*"));


This allows me to enter the first few letters of a city name and the search 
will display all records matching those letters and anything else that 
follows them.

How do I do the same thing in VBA code for the following subroutine?
================================================

Private Sub Cmdcity_Click()

Dim db As Database
     Dim qdf As QueryDef
     Dim strSQL As String
     Set db = CurrentDb
     Set qdf = db.QueryDefs("results")


     strSQL = "SELECT SaleComps.* " & _
              "FROM SaleComps " & _
              "WHERE SaleComps.City='" & Me.City.Value & "' " & _
              "ORDER BY SaleComps.file"
    qdf.SQL = strSQL
     DoCmd.OpenQuery "results"
     DoCmd.OpenForm "Master Form"
             DoCmd.Close acForm, Me.Name
     Set qdf = Nothing
     Set db = Nothing



End Sub

===============================================================

Thanks in advance.

Gary










Gary E. Daniels
Cornerstone Appraisal Company
500 Selkirk Drive
Schaumburg, IL. 60194
847 882-5892  Fax 847 882-5963
mailto:[EMAIL PROTECTED]
http://www.askdata.net



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/7EuRwD/fOaOAA/yQLSAA/q7folB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ms_access/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to