Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    1st try - clear screen

    THis is my first attemp to write a small "program". I created a form with 6 fields. The first it Job Number (strjob). Now I want to create a cmdbutton that will clear the field if any data is in it. What am I doing wrong.

    Private Sub cmdSubmit_Click()
    Call clear_Change
    End Sub

    Private Sub clear_Change()
    Dim strjob As Single
    strjob = ""
    End Sub

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: 1st try - clear screen

    Hi Daniel,
    You've declared strJob as a single and then tried to assign it an empty string. You either need to declare it as a string (which is what the name strjob implies) or use strjob = 0
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: 1st try - clear screen

    In addition to Rory's comment:

    There still doesn't seem to be any connection between what's in either cmdSubmit_Click or clear_Change, and the state of the field (TextBox?) called JobNumber.

    Assuming you've got a textbox called txtJobNumber on a userform, you can clear the contents of txtJobNumber (when the user clicks on the Submit commandbutton) by using:

    Private Sub cmdSubmit_Click()
    txtJobNumber.Value = ""
    End Sub

  4. #4
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 1st try - clear screen

    Thanks guys, I got it working fine.

Posting Permissions

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