Results 1 to 2 of 2

Thread: syntax issue

  1. #1
    Join Date
    Apr 2004
    Location
    ny, ny
    Posts
    224

    Unanswered: syntax issue

    checkoutList = "SELECT Checkouts.CheckoutID, Checkouts.IssuerName as [NAME], Checkouts.Tel as [TEL], Checkouts.email as [EMAIL], checkouts.startdate as [DATE ISSUED], checkouts.enddate as [RETURN DATE]" & _

    dbCW.Execute ("UPDATE checkouts set [enddate] = #" & Date & "# where [checkoutid] ='" & checklist.checkoutID & "'")

    CheckoutID is autonumber
    There seems to be something wrong with the syntax, could someone help me out

    thank you

  2. #2
    Join Date
    Feb 2004
    Posts
    533
    If you are using a form to do this, then why can't you can include the checkin date in the forms recordsource and just enter the date in the form field? If you don't have access by a form field then you can do this with DAO.

    Update method like this.
    Code:
     Sub UpdateRec()
    Dim rst As Recordset
    Dim recIndex As Integer
    Dim strQry As String
    
    recIndex = "'" & Me.checkoutID
    
    strQry = "SELECT checkouts.checkoutid, checkouts.enddate" & _
            " FROM [checkouts]" & _
            "WHERE (((checkouts.checkoutid)=" & recIndex & "))"
            
    Set rst = CurrentDb.OpenRecordset(strQry, dbOpenDynaset)
    
    With rst
        If .RecordCount = 1 Then
            rst.MoveFirst
            If IsNull(![enddate]) Then
                .Edit
                ![enddate] = Now()
                .Update
                MsgBox "Date Updated"
            End If
        Else
        MsgBox "A unique record Index for checkoutid# '" & recIndex & "' was not found"
        End If
    End With
    
    End Sub
    ~

    Bill

Posting Permissions

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