Hi All!
I feel like a real dope for asking this question as I have been working as an Access programmer for nearly 6 years, but...
Does anybody know if it is possible to update a field in a form's Record Source (through the form) without having a control on the form that is associated with that field?
Here's my dilemma: I am making some updates to an Access app that was developed by someone who is long gone now and was kind enough NOT to leave any documentation behind. Within the app, there is a form that is used by users to make updates to some of the database records. In the form's Record Source, there are 2 fields, last_updated_date and last_updated_by that capture these values whenever a record is updated. Now, the problem I'm having is in the VBA behind this form there is a Sub routine that looks like:
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Process
If txtItem = "" Or IsNull(txtItem) Then
Me.Undo
Cancel = True
Else
Me.last_update_date = Now()
Me.last_updated_by = strUserName
End If
Exit_Process:
Exit Sub
Err_Process:
MsgBox Err.Description
Resume Exit_Process:
End Sub
OK, so far everything looks pretty standard, however, the form controls Me.last_update_date and Me.last_updated_by don't seem to exist on the form. Another thing that I found interesting is that the only property these controls have available is "Value", So, I'm wondering, is there a way to somehow insert a Record Source field directly into a form without actually assigning it to a control? Seems simple but I'm stumped. Any thoughts will be greatly appreciated.
Thanks in advance!
Nate
I feel like a real dope for asking this question as I have been working as an Access programmer for nearly 6 years, but...
Does anybody know if it is possible to update a field in a form's Record Source (through the form) without having a control on the form that is associated with that field?
Here's my dilemma: I am making some updates to an Access app that was developed by someone who is long gone now and was kind enough NOT to leave any documentation behind. Within the app, there is a form that is used by users to make updates to some of the database records. In the form's Record Source, there are 2 fields, last_updated_date and last_updated_by that capture these values whenever a record is updated. Now, the problem I'm having is in the VBA behind this form there is a Sub routine that looks like:
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Process
If txtItem = "" Or IsNull(txtItem) Then
Me.Undo
Cancel = True
Else
Me.last_update_date = Now()
Me.last_updated_by = strUserName
End If
Exit_Process:
Exit Sub
Err_Process:
MsgBox Err.Description
Resume Exit_Process:
End Sub
OK, so far everything looks pretty standard, however, the form controls Me.last_update_date and Me.last_updated_by don't seem to exist on the form. Another thing that I found interesting is that the only property these controls have available is "Value", So, I'm wondering, is there a way to somehow insert a Record Source field directly into a form without actually assigning it to a control? Seems simple but I'm stumped. Any thoughts will be greatly appreciated.
Thanks in advance!
Nate