
Run-time error 3141 PLS HELP
I'm trying to modify form code for a new index. Why I get
to the Select area, I'm getting "Run-time error 3141, the
SELECT statement includes a reserved word or an
argument name that is misspelled or missing, or the
punctuatin is incorrect."
The code so far is.
Option Compare Database
Private Sub cmdGenerate_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset, rstOM As DAO.Recordset,
rstType As DAO.Recordset
Dim qryDef As String, totalrec As String, msg As
String
Dim x As Integer
If cboCountry >= 0 Then
DoCmd.RunSQL ("delete * from Org_Geo")
DoCmd.SetWarnings False
Set dbs = CurrentDb
Set rstOM = dbs.OpenRecordset("SELECT
OrgMaster.OrgId, OrgMaster.OrgName,
OrgMaster.State, " & _
"OrgMaster.ProvinceId,
OrgMaster.CountryId, " & _
"FROM Lkcountry RIGHT JOIN (Lkstate
INNER JOIN OrgMaster ON Lkstate.State =
OrgMaster.State) " & _
"ON OrgMaster.CountryId =
Lkcountry.CountryId WHERE Lkcountry.CountryId = " &
cboCountry & _
" ORDER BY OrgName", dbOpenDynaset)
Set rstType = dbs.OpenRecordset("Select
count(orgid) as totalrec from orgmaster where State =
" & cboCountry, dbOpenDynaset)
totalrec = CStr(rstType!totalrec)
x = 1
txtmsg.Visible = True
Any help, please, appreciated.
Max