Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6354167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:32:02+00:00 2026-05-24T22:32:02+00:00

My example VB6 program: Dim conn As New connection conn.Open Driver={Microsoft Access Driver (*.mdb)};Dbq=

  • 0

My example VB6 program:

Dim conn As New connection
conn.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & App.Path & "\adatabase.mdb;"
conn.Execute "INSERT INTO atable (afield) VALUES (""some text"")"
End Sub

(“adatabase.mdb” contains one table “atable” with one field “afield” of type “Text” length 255. Access 2002, Access file format 2000. VB6 references include “Microsoft ActiveX Data Objects 2.8 Library”.)

conn.Execute gets:

Runtime error ‘-2147217904 (80040e10’ [Microsoft][ODBC Access Driver] Too few parameters. Expected 1.

The query

INSERT INTO atable (afield) VALUES ("some text")

runs directly in Access without any problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:32:02+00:00Added an answer on May 24, 2026 at 10:32 pm

    Shouldn’t that be:

    conn.Execute "INSERT INTO atable (afield) VALUES ("""some text""")"
    

    i.e. you need to quote the double quotes?

    Update: or as the poster solved, use single quotes to quote text.

    Or even better, use a parameterised query:

    Dim Conn1 As ADODB.Connection
    Dim Cmd1 As ADODB.Command
    Dim Param1 As ADODB.Parameter
    Dim Rs1 As ADODB.Recordset
    
    ' Create and Open Connection Object.
    Set Conn1 = New ADODB.Connection
    Conn1.ConnectionString = "DSN=Biblio;UID=admin;PWD=;"
    Conn1.Open
    
    ' Create Command Object.
    Set Cmd1 = New ADODB.Command
    Cmd1.ActiveConnection = Conn1
    Cmd1.CommandText = "SELECT * FROM Authors WHERE AU_ID < ?"
    
    ' Create Parameter Object.
    Set Param1 = Cmd1.CreateParameter(, adInteger, adParamInput, 5)
    Param1.Value = 5
    Cmd1.Parameters.Append Param1
    Set Param1 = Nothing
    
    ' Open Recordset Object.
    Set Rs1 = Cmd1.Execute()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working in a classic VB6 app, crazy comments by the thousands. Example: If garrFilePaths(i).FilePath
Could someone provide some example on implementing SEH in VB6? Everything I've seen so
Example int *ptr; *ptr = 1000; can I catch memory access violation exception using
I am currently trying to convert a VB6 program into C#. There was extensive
Wondering if we have something like vb6 with..End With Statement in Objective-c? Example: With
Using VB 6 and Access 2003 Code Dim db As Database, tbl As TableDef
In my VB6 program, I have tons of hotkeys such as X, A, D...
Using VB6 I am saving the user the entry in the database. Code. rst.Open
We have a legacy VB6 app, which is critical to our business. We're working
How to use sql compact database from a non .NET program? For example I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.