WhyACESS??????
New member
- Local time
- Today, 12:55
- Joined
- Dec 11, 2008
- Messages
- 4
ERROr code "Invalid SQL statement;expected "Delete, Insert, Procedure, Select, or...
Hello all
As you can see I'm having trouble with this error
ERROr code "Invalid SQL statement;expected "Delete, Insert, Procedure, Select, or Update
I'm trying to transfer data from a Acess form to a Word table.
It is very simple, but for some reason it has a problem with Open method code If some one could look over what I've done, I would appreciate it greatly.
Hello all
As you can see I'm having trouble with this error
ERROr code "Invalid SQL statement;expected "Delete, Insert, Procedure, Select, or Update
I'm trying to transfer data from a Acess form to a Word table.
It is very simple, but for some reason it has a problem with Open method code If some one could look over what I've done, I would appreciate it greatly.
Code:
Private Sub cmdFlyer_Click()
Dim appWord As Word.Application
Dim docWord As Word.Document
Dim rngInsertionPoint As Word.Range
Dim rstPets As New ADODB.Recordset
Dim strName As String
Dim strType As String
Dim strSize As String
Dim strDescription As String
Set appWord = New Word.Application
appWord.Documents.Add
Set docWord = appWord.Documents(1)
docWord.Application.Visible = True
Set rngInsertionPoint = docWord.Paragraphs(1).Range
rngInsertionPoint.Text = "Pets"
docWord.Paragraphs.Add
Set rngInsertionPoint = docWord.Paragraphs(2).Range
With rngInsertionPoint
.Collapse Direction:=wdCollapseEnd
.Tables.Add rngInsertionPoint, 1, 4
End With
With rngInsertionPoint.Tables(1).Rows.Last
.Cells(1).Range.Text = "Name"
.Cells(2).Range.Text = "Type"
.Cells(3).Range.Text = "Size"
.Cells(4).Range.Text = "Description"
End With
[B]rstPets.Open "Pets", _
CurrentProject.Connection, adOpenStatic (Problem Area) [/B]
With rstPets
strName = .Fields("Name")
strType = .Fields("Type")
strSize = .Fields("Size")
strDescription = .Fields("Description")
End With
rngInsertionPoint.Tables(1).Rows.Add
With rngInsertionPoint.Tables(1).Rows.Last
.Cells(1).Range.Text = strName
.Cells(2).Range.Text = strType
.Cells(3).Range.Text = strSize
.Cells(4).Range.Text = strDescription
End With