Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inserting Data in a Table Via ADO Code (2003)

    If you select October 4, 2005, click the "Set date" button, click the "Production data" button on the startup form of the attached mdb and enter, say, 82388 in the "Termica" text box for the 24-hour record, the code stops at the .Execute line in the Private Sub Termica_AfterUpdate() with the message
    <font color=red>Run-time error '-2147217904(80040e10)':
    No value specified for some required parameters.</font color=red>

    I guess there's something wrong with
    <font color=448800>.CommandText = "INSERT INTO vap1(giorno, " & _
    "ener) VALUES (gio,energia)"</font color=448800>
    but can't figure out what it is.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Inserting Data in a Table Via ADO Code (2003)

    You have included the variables gio and energia in the SQL statment, but ADO doesn't know about VBA variables. You must put the literal values of the variables in the SQL string by concatenation:

    .CommandText = "INSERT INTO vap1(giorno, ener) VALUES (#" & _
    Format(gio, "mm/dd/yyyy") & "#, " & Energia & ")"

    The date value has been enclosed in # and forced into US date format.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting Data in a Table Via ADO Code (2003)

    Thank you Hans

Posting Permissions

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