You are having a problem with spelling (missing an e in RcordSt
You also have not Set dBase =Currentdb
You should avoid DoCmd.SetWarnings False ' this masks good feedback
Instead of DoCmd.RunSQL (stringSQL) use dbase.execute (stringSQL,dbFailOnError) which will only give a message if an error occurs
I replaced your For Loop with a Do While Loop (just seems cleaner to me) you can do as you wish.
Openrecordset gives position on first record (if there is one).
Code:
Sub To_DoQuery()
Dim RecordSt As Recordset
Dim dBase As Database
Dim stringSQL As String
Dim rCnt As Integer
stringSQL = "CREATE TABLE CityTbl (City TEXT(25), State TEXT(25));"
DoCmd.RunSQL (stringSQL)
stringSQL = "insert into citytbl([City],[State])"
stringSQL = stringSQL & "Values('Fort Worth', 'Texas');"
'DoCmd.SetWarnings False
DoCmd.RunSQL (stringSQL)
stringSQL = "insert into citytbl([City],[State])"
stringSQL = stringSQL & "Values('Dallas', 'Texas');"
'DoCmd.SetWarnings False
DoCmd.RunSQL (stringSQL)
stringSQL = "SELECT CityTbl.* FROM CityTbl;"
Set dBase = CurrentDb
Set RecordSt = dBase.OpenRecordset(stringSQL)
' !!!!!!!!!!!!!!!!! Run-time error 91 (On line above)
'!!!!!!!!!!!!!!!!!!!!!!Object variable or with block variable not set
Do While Not RecordSt.EOF
'RecordSt.MoveFirst
'For rCnt = 0 To RecordSt.RecordCount
MsgBox (RecordSt.Fields("City").Value & "," & RecordSt.Fields("state").Value)
RecordSt.MoveNext
'Next rCnt
Loop
End Sub
As you can see, attention to detail is critical.
You may wish to investigate debugging techniques at
http://www.cpearson.com/excel/debug.htm