Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Location
    West Chester, Pennsylvania, USA
    Posts
    5

    Unanswered: Add Record - Type Mismatch

    I am attempting to add data to a table through a form. The fields I am displaying in combo boxes are bound to fields that are setup as AutoNumber Fields.

    I am attempting to run the following SQL statment to update a specific table:

    Dim User As Long, Category As Long, Skill As Long, Level As Long
    Dim Using As Long, Last As Long
    User = Me.Combo134
    Category = Me.Combo120
    Skill = Me.Combo116
    Level = Me.Combo126
    Using = Me.Combo128
    Last = Me.Combo130

    strSQL1 = "insert into Employee_Skill_Data (UserID, Category_ID, SkillID, Skill_Level, TimeID, LastUsedID) VALUES (& User &, & Category &, & Skill &, & Level &, & Using &, & Last &);"
    DoCmd.SetWarnings False
    DoCmd.RunSQL strSQL1
    DoCmd.SetWarnings True

    DoCmd.GoToRecord , , acNewRec

    All I get back is a Type Mismatch error.

    Can anyone see what I am doing wrong? Any help I can get would be helpful.

    Thanks.

    Neil

  2. #2
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238
    If you link the table to the form (using the forms RecordSource property), there is no need to have any code to update the form, the work will be done for you automatically. Provided the combo boxes are linked to the relevant fields in the form (via their ControlSource property)

    Regards
    Justin

  3. #3
    Join Date
    Oct 2004
    Location
    West Chester, Pennsylvania, USA
    Posts
    5
    Justin,

    Thank you, but I figured out my problem. Missing quotation marks in my SQL statement.

    Neil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •