Go Back  Xtreme Visual Basic Talk > Other Languages > Web Programming > syntax error in FORM clause


Reply
 
Thread Tools Display Modes
  #1  
Old 07-14-2003, 01:50 AM
Ossenaar Ossenaar is offline
Newcomer
 
Join Date: Jul 2003
Location: Netherlands
Posts: 3
Exclamation syntax error in FORM clause


Hello,

I have an problem with the following sql-statement.

Private Sub Form_Activate()
Set RS1 = deGenUrex.rsMedewerkers
If RS1.State = adStateOpen Then
RS1.Close
End If
RS1.Open ("SELECT * FROM [Medewerkers] WHERE ([Medewerkers.emno] = " & txtMedew.Text & ")")
txtCWTT.Text = LTrim(RTrim(RS1.Fields("cwtt")))
RS1.Close
Set RS1 = Nothing
End Sub

When I login for the first time the sql-statement works, but when I logout an login with an other user I get error message:

"Run-time error '-2147217900 (80040e14)':
Syntax error in FORM clause."

What did I do wrong?
Is there someone who can help me?
Thanks in advance.
Best regards,
Reply With Quote
  #2  
Old 07-14-2003, 07:27 AM
2bNvUs's Avatar
2bNvUs 2bNvUs is offline
Centurion
 
Join Date: Apr 2003
Location: Birmingham, AL
Posts: 165
Default

Quote:
Originally Posted by Ossenaar
Hello,

I have an problem with the following sql-statement.

Private Sub Form_Activate()
Set RS1 = deGenUrex.rsMedewerkers
If RS1.State = adStateOpen Then
RS1.Close
End If
RS1.Open ("SELECT * FROM [Medewerkers] WHERE ([Medewerkers.emno] = " & txtMedew.Text & ")")
txtCWTT.Text = LTrim(RTrim(RS1.Fields("cwtt")))
RS1.Close
Set RS1 = Nothing
End Sub

When I login for the first time the sql-statement works, but when I logout an login with an other user I get error message:

"Run-time error '-2147217900 (80040e14)':
Syntax error in FORM clause."

What did I do wrong?
Is there someone who can help me?
Thanks in advance.
Best regards,




When you say login, what do you mean? Login to the program that you are working on?
__________________
I was just checkin' the...uh...specs on the..uh.. inline rotary..gu...I'm retarded. [I]-Chris Farley-Tommy Boy
Reply With Quote
  #3  
Old 07-14-2003, 08:01 AM
Ossenaar Ossenaar is offline
Newcomer
 
Join Date: Jul 2003
Location: Netherlands
Posts: 3
Default

Quote:
Originally Posted by 2bNvUs
Quote:
Originally Posted by Ossenaar
Hello,

I have an problem with the following sql-statement.

Private Sub Form_Activate()
Set RS1 = deGenUrex.rsMedewerkers
If RS1.State = adStateOpen Then
RS1.Close
End If
RS1.Open ("SELECT * FROM [Medewerkers] WHERE ([Medewerkers.emno] = " & txtMedew.Text & ")")
txtCWTT.Text = LTrim(RTrim(RS1.Fields("cwtt")))
RS1.Close
Set RS1 = Nothing
End Sub

When I login for the first time the sql-statement works, but when I logout an login with an other user I get error message:

"Run-time error '-2147217900 (80040e14)':
Syntax error in FORM clause."

What did I do wrong?
Is there someone who can help me?
Thanks in advance.
Best regards,




When you say login, what do you mean? Login to the program that you are working on?



2bNvUs,
Yes, I have made a program for several users. And with there login-code they activate the program.
Ossenaar
Reply With Quote
  #4  
Old 07-14-2003, 08:28 AM
2bNvUs's Avatar
2bNvUs 2bNvUs is offline
Centurion
 
Join Date: Apr 2003
Location: Birmingham, AL
Posts: 165
Default

Code:
Set RS1 = deGenUrex.rsMedewerkers If RS1.State = adStateOpen Then RS1.Close [B][I]Set RS1 = Nothing[/I][/B] End If RS1.Open ("SELECT * FROM [Medewerkers] WHERE ([Medewerkers.emno] = " & txtMedew.Text & ")") txtCWTT.Text = LTrim(RTrim(RS1.Fields("cwtt"))) RS1.Close Set RS1 = Nothing
__________________
I was just checkin' the...uh...specs on the..uh.. inline rotary..gu...I'm retarded. [I]-Chris Farley-Tommy Boy
Reply With Quote
  #5  
Old 07-14-2003, 11:53 AM
xamua xamua is offline
Centurion
 
Join Date: Dec 2002
Location: Here I am!
Posts: 184
Default

Quote:
Originally Posted by 2bNvUs
Code:
Set RS1 = deGenUrex.rsMedewerkers If RS1.State = adStateOpen Then RS1.Close [B][I]Set RS1 = Nothing[/I][/B] End If RS1.Open ("SELECT * FROM [Medewerkers] WHERE ([Medewerkers.emno] = " & txtMedew.Text & ")") txtCWTT.Text = LTrim(RTrim(RS1.Fields("cwtt"))) RS1.Close Set RS1 = Nothing



why would you tell him to set the object to nothing and then to try to use that same object again a couple lines later?

if txtMedew.Text is NOT a numeric value it needs single quotes around it in the SQL
and this is clearly not ASP....
__________________
"Whom are you?" said he, for he had been to night school.
-- George Ade
"A long memory is the most subversive idea in America."
-- Unknown
Reply With Quote
  #6  
Old 07-14-2003, 12:05 PM
2bNvUs's Avatar
2bNvUs 2bNvUs is offline
Centurion
 
Join Date: Apr 2003
Location: Birmingham, AL
Posts: 165
Default

Well, if it is open already, then the If statement tells it to close and set it to nothing, It then proceeds to open it again, so that it is not trying to open a connection that is already open. The program has a log in and logout, he said that the Query worked the first time but not after that. That is why I thought it could be that he is not setting the RS1 to nothing first before trying to reopen it (without closing the app.)
__________________
I was just checkin' the...uh...specs on the..uh.. inline rotary..gu...I'm retarded. [I]-Chris Farley-Tommy Boy
Reply With Quote
  #7  
Old 07-15-2003, 03:05 AM
Ossenaar Ossenaar is offline
Newcomer
 
Join Date: Jul 2003
Location: Netherlands
Posts: 3
Default

Quote:
Originally Posted by 2bNvUs
Well, if it is open already, then the If statement tells it to close and set it to nothing, It then proceeds to open it again, so that it is not trying to open a connection that is already open. The program has a log in and logout, he said that the Query worked the first time but not after that. That is why I thought it could be that he is not setting the RS1 to nothing first before trying to reopen it (without closing the app.)



2bNvUs,

Your solutions didn't work, but thanks anyway. The problem is solved.

Ossenaar
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multi connections, one port? burningodzilla Communications 5 08-02-2005 05:04 PM
MDI Form and dimensions kkonkle Interface and Graphics 6 03-26-2003 09:50 AM
Disable Mouse Scroll in Sub Form nickg96 Database and Reporting 16 10-04-2002 11:12 AM
WinSock vbsupernewbie Communications 1 09-12-2001 10:20 PM
Create a new form similar to an existing form ric General 6 07-17-2001 12:47 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->