Rabu, 09 Mei 2012

[MS_AccessPros] Re: Syntax error in From clause

 

Thanks Duane! I'll put that in my tool box.

--- In MS_Access_Professionals@yahoogroups.com, "Duane" <duanehookom@...> wrote:
>
> Connie,
> I see John has already provided the fix. One of the good practices many of us use is to create a string variable for the SQL statement like:
>
> Dim strSQL as String
> strSQL = "SELECT HomeInfo.Nbr, HomeInfo.Direction1, " _
> & "Street_List.Street, HomeInfo.Direction2, City_List.City, HomeInfo.StreetComb " _
> & "FROM City_List INNER JOIN " _
> & "(Street_List INNER JOIN HomeInfo ON Street_List.StreetID = HomeInfo.StreetID) " _
> & "ON City_List.CityID = HomeInfo.CityID) " _
> & "WHERE HomeInfoID = " & Me.HomeInfoIDHeader & ";"
> Debug.Print strSQL 'for debugging the syntax
> Set rstSt = db.OpenRecordset(strSQL)
>
> Duane Hookom
> MS Access MVP
>
> --- In MS_Access_Professionals@yahoogroups.com, mrsgoudge <no_reply@> wrote:
> >
> > Good morning!
> >
> > Would you take a gander at this to see what's giving the "syntax error in from clause" message? I know I should be able to figure it out but have had no luck.
> >
> > Thanks!
> > Connie
> >
> > Set rstSt = db.OpenRecordset("SELECT HomeInfo.Nbr, HomeInfo.Direction1, " _
> > & "Street_List.Street, HomeInfo.Direction2, City_List.City, HomeInfo.StreetComb " _
> > & "FROM City_List INNER JOIN " _
> > & "(Street_List INNER JOIN HomeInfo ON Street_List.StreetID = HomeInfo.StreetID) " _
> > & "ON City_List.CityID = HomeInfo.CityID) " _
> > & "WHERE HomeInfoID = " & Me.HomeInfoIDHeader & ";")
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar