[AccessD] Jet version sql error Try 2

Darren D darren at activebilling.com.au
Mon Sep 10 23:37:39 CDT 2007


Hi Doug

A way out guess here - what happens when you change

 fldCountry = 'United States';"

to fldCountry = ""United States"" ;"

Darren
-----------------
T: 0424 696 433
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Murphy
Sent: Tuesday, 11 September 2007 2:13 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Jet version sql error Try 2

 
OK I'll try again with a simpler (?) question.

Any one see a reason why the following sql string generates an error when
used to open a recordset?

"Select * From tblUserFormat Where fldCountry = 'United States';"

Generates an error 3075 when run in the following line:

"Set rs = db.OpenRecordset(sSQL, dbOpenDynaset)"

The error message that gives the error number 3075 indicates that there is
some problem with fldCountry = 'United States'

I have modified the code slightly from my first post to use a dynaset type
recordset and added the semicolon at the end of the query string.  Same
error is generated with the updated code.  The complete procedure up to this
point is as follows.

Public Sub GetCountrySettings()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim sSQL As String
Dim sCountrySettings As String
Dim fld As Field
Dim LCID As Long

  LCID = 0  'GetSystemDefaultLCID()

   On Error GoTo GetCountrySettings_Error

      sCountrySettings = GetUserLocaleInfo(LCID, LOCALE_SCOUNTRY)
      tFM.sCountry = sCountrySettings
      
      If Not IsNull(sSQL) Then
            sSQL = "Select * From tblUserFormat Where fldCountry = '" &
sCountrySettings & "';"
            Set db = CurrentDb
            Set rs = db.OpenRecordset(sSQL, dbOpenDynaset)
            rs.MoveFirst

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list