DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5

Thread: bad syntax?

  1. #1
    Join Date
    May 2004
    Posts
    52

    bad syntax? SOLVED

    hello
    i am tryig to get my vb form to creata new table in an existing db
    i am using the following code

    Option Explicit
    Private Sub cmdCreateTable_Click()
    Dim conScores As ADODB.Connection
    Dim strSQL As String
    Set conScores = New ADODB.Connection
    conScores.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source='C:\temp\db3.mdb'"

    strSQL = "CREATE TABLE scores (" & _
    "Option1 bit," & "option2 bit," & "opt3 bit," & "opt4 bit," & "opt5 bit," & _
    "opt6 bit," & "opt7 bit," & "opt8 bit," & _
    "opt9 bit" & "opt10 bit," & "opt11 bit," & _
    "opt12 bit," & "opt13 bit," & "opt14 bit," & _
    "opt15 bit," & "opt16 bit," & "opt17 bit," & _
    "opt618 bit," & "opt19 bit," & "opt20 bit," & _
    "opt21 bit," & "opt22 bit," & "opt23 bit," & _
    "opt24 bit," & "opt25 bit," & "opt26 bit," & _
    "opt27 bit," & "opt28 bit," & "opt29 bit," & _
    "opt30 bit," & "opt31 bit," & "opt32 bit," & _
    "opt33 bit," & "opt34 bit);"

    conScores.Execute strSQL ' i get the error here


    MsgBox "A table named Scores has been added to the db3.mdb database"

    Set conScores = Nothing
    End Sub
    i get "sytax error in field defintion"
    what have i missed
    Mac
    Last edited by MacataQ; 07-26-2005 at 01:15 PM. Reason: SOLVED

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    You're missing a comma:

    "opt9 bit," & "opt10 bit," & "opt11 bit," & _
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    May 2004
    Posts
    52
    omg , what a dope i am
    cant see whats in front of me..lol
    thanks Paul

  4. #4
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    jeez Paul, you DO have a good eye!
    In cases like this, I prefer to create my command string in a loop, because I know that I will miss something... besides my eyesight
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  5. #5
    Join Date
    Dec 2003
    Posts
    2,750
    Yeah, I only spent about five minutes looking at the statement before I finally noticed the missing comma. ;-)
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

Similar Threads

  1. Replies: 1
    Last Post: 11-11-2002, 03:06 PM
  2. VB6 vs VB.NET...Procedure Calling Syntax
    By Patrick Troughton in forum .NET
    Replies: 78
    Last Post: 08-13-2002, 11:18 AM
  3. Replies: 16
    Last Post: 08-12-2002, 10:06 PM
  4. Replies: 90
    Last Post: 04-17-2001, 12:45 AM
  5. Replies: 1
    Last Post: 03-16-2000, 09:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links