|
-
Jun 9th, 2004, 07:13 AM
#1
Thread Starter
Fanatic Member
Error in From Cluase
i have an error in this from clause, i'm not really sure why it is. but here is the code.
VB Code:
'****************************************************
'the form loads with a connection the Test Query in
'access
Private Sub Form_Load()
If sgrs.State = adStateClosed Then
Debug.Print "sgrs is closed"
sgrs.Open "SELECT * FROM Test", DBConn, adOpenDynamic, adLockOptimistic
Call Display(0)
sgrs.MoveFirst
Else
Debug.Print "Sgrs is open"
Call Display(0)
End If
If Trs.State = adStateClosed Then
Debug.Print "trs is closed"
Trs.Open "SELECT * FROM Check", DBConn, adOpenDynamic, adLockOptimistic
End If
End Sub
Trs and sgrs are both declared in the heading as global variables. i need to access both of the tables in order to get info from both of them. the tables are in Access97
-
Jun 9th, 2004, 09:01 AM
#2
Re: Error in From Cluase
Originally posted by Dubya007
i have an error in this from clause, i'm not really sure why it is. but here is the code.
VB Code:
'****************************************************
'the form loads with a connection the Test Query in
'access
Private Sub Form_Load()
If sgrs.State = adStateClosed Then
Debug.Print "sgrs is closed"
sgrs.Open "SELECT * FROM Test", DBConn, adOpenDynamic, adLockOptimistic[color=red], adCmdText[/color]
Call Display(0)
sgrs.MoveFirst
Else
Debug.Print "Sgrs is open"
Call Display(0)
End If
If Trs.State = adStateClosed Then
Debug.Print "trs is closed"
Trs.Open "SELECT * FROM Check", DBConn, adOpenDynamic, adLockOptimistic[color=red], adCmdText[/color]
End If
End Sub
Trs and sgrs are both declared in the heading as global variables. i need to access both of the tables in order to get info from both of them. the tables are in Access97
Not sure.
Whats the exact error?
Add in the parts in red, if the objects are recordsets.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 9th, 2004, 09:11 AM
#3
Thread Starter
Fanatic Member
i get an error that says: "Syntax error in FROM clause"
then the debugger highlights the from clause where this statement is:
VB Code:
Trs.Open "SELECT * FROM Check", DBConn, adOpenDynamic, adLockOptimistic
yes they are supposed to be recordsets but can i ask what the parts in red are? i am new to all of this. but thanx for the help
-
Jun 9th, 2004, 09:59 AM
#4
Check may be a reserved/key word. Surround it with square brackets or change the table name.
Select * From [Check]
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
|