Results 1 to 11 of 11
  1. #1
    R_jang is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    4

    Command button click event

    Sorry it's very basic question. I have a very simple form, couple of text boxes and a Command Button. On Click event of command button I want to clear all my text boxes but when I click nothing happens.



    Private Sub CmdReset_Click()
    MsgBox "Clear", vbOKOnly
    TxtVendorName.Value = ""
    TxtDesc.Value = ""
    TxtOrderDay.Value = ""
    TxtDeliveryDay.Value = ""
    TxtComments.Value = ""
    End Sub

    Thanks.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Did you just type in this: "Private Sub CmdReset_Click()"
    Maybe the click event was not link to this sub?
    try to right click the button and select "build event" to build the event.

  3. #3
    R_jang is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    4
    Thanks for the quick response. I have tried that but didn't work. Even form_load doesn't work... May be link is broken between form and VB code. I need to register/attach form with Code? I don't know... I am just saying... I am new with MS Access.

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    have you ever changed the button's name "CmdReset" ?

    when you right click on the button and select "build event", does Access lead you to this codes?

  5. #5
    R_jang is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    4
    No.

    Yes if I right click "event" it takes me right at "click event sub".

  6. #6
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I can't figure out other cause

  7. #7
    Join Date
    May 2010
    Posts
    339
    Quote Originally Posted by R_jang View Post
    Sorry it's very basic question. I have a very simple form, couple of text boxes and a Command Button. On Click event of command button I want to clear all my text boxes but when I click nothing happens.

    Private Sub CmdReset_Click()
    MsgBox "Clear", vbOKOnly
    TxtVendorName.Value = ""
    TxtDesc.Value = ""
    TxtOrderDay.Value = ""
    TxtDeliveryDay.Value = ""
    TxtComments.Value = ""
    End Sub

    Thanks.
    Have you tried...
    Code:
    Private Sub CmdReset_Click()
    MsgBox "Clear", vbOKOnly
    Me.TxtVendorName = ""
    Me.TxtDesc = ""
    Me.TxtOrderDay = ""
    Me.TxtDeliveryDay = ""
    Me.TxtComments = ""
    End Sub

  8. #8
    Hank44 is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    2

    Maybe?

    Try getting rid of the .value ext and try something like

    Me.Txtbox1=""

    Could work......

  9. #9
    jhcarrell's Avatar
    jhcarrell is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    Alabama
    Posts
    10
    I believe you could accomplish this using a click event macro:

    Action > SetValue
    Arguments > Item: [Forms]![formName]![controlName] Expression: Null

    Just a thought.

  10. #10
    R_jang is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2010
    Posts
    4
    Private Sub CmdReset_Click()
    MsgBox "Clear", vbOKOnly
    Me.TxtVendorName = ""
    Me.TxtDesc = ""
    Me.TxtOrderDay = ""
    Me.TxtDeliveryDay = ""
    Me.TxtComments = ""
    End Sub

    Still same issue nothing happens when I click.....

  11. #11
    Join Date
    May 2010
    Posts
    339
    Try this:
    Code:
    Private Sub CmdReset_Click()
    MsgBox "Clear", vbOKOnly
    Me.TxtVendorName = ""
    Me.TxtDesc = ""
    Me.TxtOrderDay = ""
    Me.TxtDeliveryDay = ""
    Me.TxtComments = ""
    Me.Requery
    End Sub
    Are these text fields? If not try Null
    Code:
    Me.TxtComments = Null

Please reply to this thread with any new information or opinions.

Similar Threads

  1. On Click Event For Button On Form
    By Desstro in forum Forms
    Replies: 3
    Last Post: 08-09-2010, 02:36 PM
  2. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  3. On Click Event Procedure
    By MrDean in forum Forms
    Replies: 3
    Last Post: 10-07-2009, 07:16 AM
  4. Command buttom on click
    By miziri in forum Programming
    Replies: 7
    Last Post: 08-27-2009, 08:15 AM
  5. On-Click event transfer
    By nkenney in forum Forms
    Replies: 16
    Last Post: 03-26-2009, 09:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums