|
-
Jul 29th, 2004, 02:25 PM
#1
Thread Starter
Junior Member
Syntax error in "From" clause while using ADODC
Hi,
I want to use "Adodc control in my Form.
I have to necessarily use a variable name as "Table Name"
I've used "From clause" within : With Adodc1...End With block
ie. .RecordSource = " Select * From" & tableid
I encouter : "Syntax error in From clause" when I run the application.
Will you debug the syntax error please ?
Actaul code
============
Private Sub Form_Load()
Dim tableid As Integer
tableid = 10
dbfile = App.Path & "\myfile.mdb"
Set CN = New ADODB.Connection
CN.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source='" & dbfile & "';" & _
"Persist Security Info=False"
CN.Open
-----------------------------------------------------
With Adodc1
.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source='" & dbfile & "';" & _
"Persist Security Info=False"
.RecordSource = " Select * From" & tableid <----
End With
-----------------------------------------------------
Set Text1.DataSource = Adodc1
Set Text2.DataSource = Adodc1
Text1.DataField = "Student_id"
Text2.DataField = "Student_name"
End sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|