Results 1 to 8 of 8

Thread: check box help

  1. #1
    Join Date
    Dec 2003
    Posts
    37

    Unanswered: check box help

    Private Sub ClosedManager_Click()
    If Me.ClosedManager.Value = True Then
    DoCmd.RunSQL ("Update[tblIssue](Status) VALUE ('Closed');")


    End If
    End Sub
    Have been starring at this for hours now with no success

    I would appreciate if any can point out the error

    JD

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Check boxes return numeric values

    true = -1
    false = 0

    Therefore:
    Code:
    Private Sub ClosedManager_Click()
    If Me.ClosedManager.Value = -1 Then
       DoCmd.RunSQL ("Update[tblIssue](Status) VALUE ('Closed');")
    End If
    End Sub

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: check box help

    Originally posted by JD|
    Have been starring at this for hours now with no success

    I would appreciate if any can point out the error

    JD
    What error?

    BTW, your UPDATE query looks suspicious ... SYNTAX:

    UPDATE TableName SET FieldName=XXX WHERE (Condition evaluates to True);

  4. #4
    Join Date
    Feb 2004
    Posts
    142

    Re: check box help

    Originally posted by JD|
    Have been starring at this for hours now with no success

    I would appreciate if any can point out the error

    JD
    Updates are different than inserts

    UPDATE tblTableName SET [FieldName] = Somevalue

    Remember to use a where clause unless you want all records to be changed

    The SQL in example is the structure for an insert clause

    INSERT tblTableName(Fieldlist) Values(Valuelist)
    KC

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1

    Re: check box help

    Originally posted by M Owen
    What error?

    BTW, your UPDATE query looks suspicious ... SYNTAX:

    UPDATE TableName SET FieldName=XXX WHERE (Condition evaluates to True);
    That too, it looksl ike you have half an update statement and half an insert statement.


  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Teddy
    Check boxes return numeric values

    true = -1
    false = 0

    Therefore:
    Code:
    Private Sub ClosedManager_Click()
    If Me.ClosedManager.Value = -1 Then
       DoCmd.RunSQL ("Update[tblIssue](Status) VALUE ('Closed');")
    End If
    End Sub
    Ted,

    That's chasing up the wrong tree ... The conditional is perfectly fine and valid ...

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by M Owen
    Ted,

    That's chasing up the wrong tree ... The conditional is perfectly fine and valid ...
    Yeah I caught that after I read your reply. My caffiene level is dropping to a dangerously low level.

    Good catch.

  8. #8
    Join Date
    Dec 2003
    Posts
    37

    Re: check box help

    Thanks Everyone

    I know have it working except for the where statement as stated above, it updates all the fields.

    If I use me.Issid it prompts me to enter an Id number

    If Me.ClosedManager.Value = True Then
    DoCmd.RunSQL ("UPDATE tblIssue SET Status='Closed'WHERE (IssId = Me.IssId )")
    I last question is there a way to make it update with a prompt ?

    Thanks again

    JD

Posting Permissions

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