Thanks, Lonnie. Works perfect.
--- In [email protected], Lonnie Johnson <[EMAIL PROTECTED]> wrote:
>
> 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 Like '*" & InputBox("Enter City") & "*' " & _
> "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
>
>
> "Gary E. Daniels" <[EMAIL PROTECTED]> wrote: 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
>
>
>
>
>
>
>
> May God bless you beyond your imagination!
> Lonnie Johnson
> ProDev, Professional Development of MS Access Databases
> Visit me at ==> http://www.prodev.us
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and
30+ countries) for 2ยข/min or less.
>
> [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/
<*> 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/