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

How to refresh form on each new record

Status
Not open for further replies.

dkape

MIS
Mar 22, 2001
17
0
0
US
I currently have form, which on open sets the enable and locked parameters of feilds on the form based on certain record criteria. I.E. if x=1, then feild1.locked = true, else feild1.locked = false. This works fine for the first record, but when the 2nd record is selected the locked and enabled values are based on the data in the ist record as opposed to the active record.


------------------------
Private Sub Form_Open(CANCEL As Integer) ' Do this when form opens.
On Error GoTo err_no_records
DoCmd.MoveSize 0, 0

DoCmd.applyfilter , &quot;PRINTED <> -1&quot;

lngred = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngyellow = RGB(255, 255, 0) ' Used to set color of updatable feilds
lngwhite = RGB(255, 255, 255)

Dim strUserName As String
Dim StrFullName As String
strUserName = ap_GetUserName()
If (strUserName = &quot;dkape1&quot;) Then
StrFullName = &quot;Douglas Kapell&quot;
DoCmd.applyfilter , &quot;DATA_PROC = 3&quot;
DoCmd.applyfilter , &quot;PRINTED <> -1&quot;
Me.Frame_data.Enabled = True
Me.data_cmt.Enabled = True
Me.Frame_data.Locked = False
Me.data_cmt.Locked = False
Me.data_cmt.BackColor = lngyellow
Me.data_label.BackColor = lngyellow
--------------------------------------------

So I think what I need to do is have the code rerun on each new record. Am I on the right track, and if so how is this done.
 
You should to write the code for setting the locked and enabled variable in an event that ocurr when each record appear.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top