Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear form question

Status
Not open for further replies.

jeremy0028

Technical User
Oct 9, 2005
37
0
0
US
I have a form called subscriber info 1

I have the following fields

Last Name txt
First Name txt
MI txt
Address txt
City txt
State txt
Zip txt
Phone
Gender(option Group) (1=Male 2=Female)

I have 2 command buttons

One called copy from patient info- which copies info from patient demo and puts info on form called subscriber info 1


Private Sub Command35_Click()
Me.Other_Insured_Last_Name = Me.[Last Name]
Me.Other_Insured_First_Name = Me.[First Name]
Me.Other_Insured_MI = Me.MI
Me.Other_Insured_Address = Me.Address
Me.Other_Insured_City = Me.City
Me.Other_Insured_State = Me.State
Me.Other_Insured_Zip = Me.Zip
Me.Other_Insured_Phone = Me.Phone
Me.Other_Insured_Date_of_Brith = Me.[Date Of Birth]
Me.[Other Insured Gender] = Me.Gender
End Sub
command button called clear form

How would i write code so when i press the command button called clear form it will delete the selected text. from the boxs

Also i know access dosnt allow u to deselect an option group once pressed so how to i incorporate that clear form
to work on the option group as well.

 
Maybe:
Code:
Dim ctrl, astrControls
astrControls = Split("Last Name,First name,MI,Address,City,State,Zip,Date of Birth,Gender", ",")
For Each ctrl In astrControls
    Me(ctrl) = Null
Next
 
How are ya jeremy0028 . . .

Try this:
[ol][li]Enter [blue]Clr[/blue] in the [blue]Tag[/blue] property of the controls of interest.[/li]
[li]Next, in the [blue]Click[/blue] event of the button, copy/paste the following:
Code:
[blue]   Dim ctl As Control
   
   For Each ctl In Me.Controls
      If ctl.Tag = "Clr" Then ctl = Null
   Next[/blue]
[/li][/ol]
Thats it! . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top