Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2004
    Posts
    4

    Unanswered: Trying to add record

    Hi,

    I'm trying to insert a record into a database and here's the code:

    Private Sub comAddTargetDate_Click()
    On Error GoTo Err_comAddTargetDate_Click
    Dim dteTarg As String

    dteTarg = InputBox("Enter New Target Date as mm/dd/yyyy")
    If dteTarg = "" Then Exit Sub

    DoCmd.SetWarnings False

    Dim sql As String
    sql = "INSERT INTO tblIRM_Products_Service_Entry ([Target date],[Key_ID]) "
    sql = sql & "Values ('" & dteTarg & "','" & Me.Key_ID & "')"

    DoCmd.RunSQL sql

    DoCmd.SetWarnings True


    Exit_comAddTargetDate_Click:
    Exit Sub

    Err_comAddTargetDate_Click:
    MsgBox Err.Description
    Resume Exit_comAddTargetDate_Click

    End Sub


    And when the box comes up and I enter a date I get this message:

    "You entered an expression that has no value."

    Any ideas on what I'm doing wrong?
    Thanks!!!!!!!!!

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    which line it is you get the error?
    ghozy.

  3. #3
    Join Date
    Aug 2004
    Posts
    4

    trouble with Inputbox

    OK, I got it to add the date into the database, but the form that shows the date (and uses the Inputbox to add date) does not show the date immediately after the Inputbox is closed, do I need to do a re-query of some sort?

    Thanks!
    Last edited by randyamos; 08-05-04 at 21:19. Reason: wrong explanation

Posting Permissions

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