MyKidsFirst
Programmer
Hi there. I'm having trouble with enabling fields on a sub form when the user goes to a new record.
The form has several fields disabled to prevent users from accidentally altering existing records. The user has the capability to enable these fields via a check box that asks if they're sure they want to change the field. Once the field selection has changed on an existing record, I then ask the user to confirm via vbOKCancel. If the user cancels the change, the value goes back to the original value and again disables the field. Likewise if they click OK the field is disabled. I don't particuliarly like all of the messages, but that's the way the end-user wants it. These fields also have an "on double click" event that opens a form for data entry and I had to modify the event to "after update" instead of On Change because the Combo box list wouldn't allow the user to type anything without continuously prompting. Yikes. There's also enabling and disabling based on "Apply Filter".
Anyways, I think I have so many instances of enabling and disabling fields that I've inundated myself. The fields need to be enabled on a new record so that the user doesn't have to manually enable each field via the check box(es). I don't know where I should place the code...or if the code is accurate. Do I need to call out a recordset? Here's the lastest attempt.... Help. Thanks a bunch for any advice.
Sub NewRecordMark(frm As Form)
Dim intnewrec As Integer
intnewrec = frm.NewRecord
If intnewrec = True Then
Me.frmLogSub!chkUpdatePatient.SetFocus
Me.frmLogSub!NewProvider.Enabled = True
Me.frmLogSub!Patient.Enabled = True
Me.frmLogSub!NewClient.Enabled = True
Me.frmLogSub!FileNumber.Enabled = True
Me.frmLogSub!Neg.Enabled = True
Me.frmLogSub!Status.Enabled = True
Me.frmLogSub!State.Enabled = True
Else
Me.frmLogSub!chkUpdatePatient.SetFocus
Me.frmLogSub!Provider.Enabled = False
Me.frmLogSub!Client.Enabled = False
Me.frmLogSub!FileNumber.Enabled = False
Me.frmLogSub!Patient.Enabled = False
Me.frmLogSub!Neg.Enabled = False
Me.frmLogSub!Status.Enabled = False
Me.frmLogSub!State.Enabled = False
End If
End Sub
The form has several fields disabled to prevent users from accidentally altering existing records. The user has the capability to enable these fields via a check box that asks if they're sure they want to change the field. Once the field selection has changed on an existing record, I then ask the user to confirm via vbOKCancel. If the user cancels the change, the value goes back to the original value and again disables the field. Likewise if they click OK the field is disabled. I don't particuliarly like all of the messages, but that's the way the end-user wants it. These fields also have an "on double click" event that opens a form for data entry and I had to modify the event to "after update" instead of On Change because the Combo box list wouldn't allow the user to type anything without continuously prompting. Yikes. There's also enabling and disabling based on "Apply Filter".
Anyways, I think I have so many instances of enabling and disabling fields that I've inundated myself. The fields need to be enabled on a new record so that the user doesn't have to manually enable each field via the check box(es). I don't know where I should place the code...or if the code is accurate. Do I need to call out a recordset? Here's the lastest attempt.... Help. Thanks a bunch for any advice.
Sub NewRecordMark(frm As Form)
Dim intnewrec As Integer
intnewrec = frm.NewRecord
If intnewrec = True Then
Me.frmLogSub!chkUpdatePatient.SetFocus
Me.frmLogSub!NewProvider.Enabled = True
Me.frmLogSub!Patient.Enabled = True
Me.frmLogSub!NewClient.Enabled = True
Me.frmLogSub!FileNumber.Enabled = True
Me.frmLogSub!Neg.Enabled = True
Me.frmLogSub!Status.Enabled = True
Me.frmLogSub!State.Enabled = True
Else
Me.frmLogSub!chkUpdatePatient.SetFocus
Me.frmLogSub!Provider.Enabled = False
Me.frmLogSub!Client.Enabled = False
Me.frmLogSub!FileNumber.Enabled = False
Me.frmLogSub!Patient.Enabled = False
Me.frmLogSub!Neg.Enabled = False
Me.frmLogSub!Status.Enabled = False
Me.frmLogSub!State.Enabled = False
End If
End Sub