Results 1 to 5 of 5
  1. #1
    ajobrien is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jun 2017
    Posts
    2

    Form Entries into Table Using INSERT INTO


    Hello Everyone,

    I am new to Access and the forums, and for the last day or so I have been constantly frustrated with VBA and the Insert Into function. I am attempting to take data from a form, and insert it into a table. I have simplified and simplified again to try and debug. I am currently at only one entry on the form being entered into the table. I am stumped, here is the problem:

    When I enter a number in the "Operator_Name" field, the program works exactly as it should. When I enter a letter or alphanumeric combination, it returns run time error 3464 (Data type mismatch in criteria expression." I have tried many combinations of parentheses, brackets, double quotes, and single quotes. I have run out of patience and I think I am beginning to go crazy! Let me know if I can provide more information, here is my code:

    Private Sub Submit_Click()
    Dim strInsert As String
    Dim txtOperator As String
    Dim Operator_Name As String
    CurrentDb.Execute "INSERT INTO [Driver_Bolster_E2SC_IPPaint_Test](Operator_Name) VALUES ('" & Me.txtOperator_Name & "')"
    Debug.Print strInsert
    End Sub

    Thank you for any help,
    Alex.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If your for is using the table as the record source of the form then just evtering the value in the control will change the table. No update query needed.

  3. #3
    ajobrien is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jun 2017
    Posts
    2
    Would you mind clarifying? I'm sorry I am very new to Access. How would I directly link the form controls to the table? Just to clarify, I need the operator to fill out entries (some will be text, some will be numbers, some will be drop-down boxes) on the form, then press a submit button and have it put the data in a table. Again, I am sorry about being so inexperienced, I am learning though!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you use the Form Wizard to create your form it will ask you what table to use. It will then create a *bound* form that will allow a user to edit any record in the table including a new one. The record will automaticall be saved unless you take extra steps to prevent it. You do not need a "submit" button. Try it with a small form as a test.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    There a lots of internet sites that help in building an Access system. Crystal had a good one: http://www.accessmvp.com/strive4peace/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-18-2015, 07:39 AM
  2. Update table entries and values from form
    By Master Klick in forum Access
    Replies: 0
    Last Post: 03-15-2015, 11:49 AM
  3. Replies: 2
    Last Post: 12-22-2010, 01:46 PM
  4. Replies: 0
    Last Post: 02-24-2010, 12:56 AM
  5. Entries in table not showing on form!!!
    By corystemp in forum Access
    Replies: 6
    Last Post: 03-26-2009, 06:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums