Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2004
    Posts
    43

    Unanswered: help... sql reset button in access

    i need to reset the textbox to original value when i click the reset button

    sq11 = "select address from customers where customerid=txtcustomer"
    sql2 = "select municipality from customers where customerid=txtcustomer"
    sql3 = "select city from customers where customerid=txtcustomer"
    sql4 = "select zip from customers where customerid=txtcustomer"

    this code is not working it only output the code inside

    help....pls...

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Read the Access help about the Dirty property...
    Code:
    Sub UndoEdits()
       If Me.Dirty Then   
    		Me!btnUndo.Enabled = True	' Enable button.
       Else
    		Me!btnUndo.Enabled = False	' Disable button.
    	End If
    End SubSub btnUndo_Click()
    	Dim ctlC As Control
    		' For each control.
    		For Each ctlC in Me.Controls
    			If ctlC.ControlType = acTextBox Then
    				' Restore Old Value.
    				ctlC.Value = ctlC.OldValue
    			End If
    		Next ctlC
    End Sub

  3. #3
    Join Date
    Jun 2004
    Posts
    43
    tnx sir

    i have another question sir... i have a combobox that has customerid on it, the problem is when i change the customerid in the combobox, other value on the form does not change. like the name address... it doesn't update

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Place something like this into a code window for the On Click event of your combobox:

    Me.Filter = "[myTablesCustomeridFieldName] = '" & Me.myComboBoxName & "'"
    Me.FilterOn = True
    Me.Requery



  5. #5
    Join Date
    Jun 2004
    Posts
    43
    how can i make a reset button

    in my form users are allowed to edit, what if they want to reset back the values?

    i cant understand the code above... do you know a simpler code on a reset command button?

    thank you very much!

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    Try using the the following code line in the On Click event of a Command button:

    DoCmd.RunCommand acCmdUndo



Posting Permissions

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