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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh/New Button doesn't work entirely

Status
Not open for further replies.

Thijs

Technical User
Nov 24, 2000
31
NL
Hello,

I've got the following problem:

I have a form which is place on a tabpage. In this form there are several textfields. These fields are divided into two groups.
Furthermore there are two buttons. If button one is pressed then 3 fields get a lock and a different backgroundcolor.
If button two is clicked other fields go into lock with an other backgroundcolor. So far so good.

But, if I want to add a new record the lock from button 1 still resides. But it shouldn't be. All the fields should be editable again, but I dont know how to do it :-S

Can anyone give me a solution? The code for button one(is not its real name though) is pasted below. I am not a real programmer so the code is not that professional.

Thanks in advance,

Thijs Kromhout
The Netherlands

Private Sub Knop35_Click()
On Error GoTo Err_Knop35_Click

Me.eig_bijdr_len.BackColor = 12632256
Me.eig_bijdr_len.Locked = True
Me.inh_weekgeld.BackColor = 12632256
Me.inh_weekgeld.Locked = True
Me.periode.BackColor = 12632256
Me.periode.Locked = True
Me.vergoeding.SetFocus

Exit_Knop35_Click:
Exit Sub

Err_Knop35_Click:
MsgBox Err.Description
Resume Exit_Knop35_Click

End Sub

 
On the Current event of your form is where you want to put the code to unlock the fields. If you only want to unlock them when you are entering a new record then do this:

Sub Form_Current()
If (Me.NewRecord) then
unlock stuff here
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top