Results 1 to 2 of 2

Thread: Clearing text boxes

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132

    Red face

    Ok you all know access dont u? When you go to add a new record to a form and all the text boxes clear and the autonumber (if u have one) increases by 1? Well i want to do a similar thing in VB for my database but i dont know how to do it. I would prefer DAO but ADO if it is neccessary.

    ok i have used data1.recordset.addnew before and it was just too confusing for the user (i wrote the program and i found it confusing!) so anything that might help would be gladly appreciated....

    Harrild
    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    To clear all of the textboxes on the form you can do:

    Public Sub Clear_Boxes()

    'Iterate through the controls, if it's a textbox empty it

    Dim aBox As Control

    For Each aBox In Controls
    If TypeOf aBox Is TextBox Then aBox = Empty
    Next

    End Sub
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

Posting Permissions

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



Click Here to Expand Forum to Full Width