What is the difference in syntax for DAP with these Access form references?

  • Thread starter Thread starter alpharogue via AccessMonster.com
  • Start date Start date
A

alpharogue via AccessMonster.com

I wanted to know how I should translate these lines of VB to be compatible
with my Data Access Page. These lines are from my data entry form and are a
result from me converting the macros automatically through Access 2003. I
just needed to know what I should do behind controls on my DAP with this code
since it does not point correctly:

(What I am trying to do is auto-update fields when users edit existing
information or add a new record in the database as below.)

'------------------------------------------------------------
' CONTACT_BeforeUpdate
'
'------------------------------------------------------------
Private Sub CONTACT_BeforeUpdate(Cancel As Integer)
On Error GoTo CONTACT_BeforeUpdate_Err

' Adds a value to "Contact" field on update
Forms![CUSTOMER DATA]!CONTACT = CONTACT + 1


CONTACT_BeforeUpdate_Exit:
Exit Sub

CONTACT_BeforeUpdate_Err:
MsgBox Error$
Resume CONTACT_BeforeUpdate_Exit

End Sub



'------------------------------------------------------------
' LAST_TIME_MODIFIED_BeforeUpdate
'
'------------------------------------------------------------
Private Sub LAST_TIME_MODIFIED_BeforeUpdate(Cancel As Integer)
On Error GoTo LAST_TIME_MODIFIED_BeforeUpdate_Err

' Last time that record was modified
Forms![CUSTOMER DATA]![LAST TIME MODIFIED] = Time()

LAST_TIME_MODIFIED_BeforeUpdate_Exit:
Exit Sub

LAST_TIME_MODIFIED_BeforeUpdate_Err:
MsgBox Error$
Resume LAST_TIME_MODIFIED_BeforeUpdate_Exit

End Sub


'------------------------------------------------------------
' LAST_DATE_WORKED_BeforeUpdate
'
'------------------------------------------------------------
Private Sub LAST_DATE_WORKED_BeforeUpdate(Cancel As Integer)
On Error GoTo LAST_DATE_WORKED_BeforeUpdate_Err

' Last date that record was modified
Forms![CUSTOMER DATA]![LAST DATE WORKED] = DATE

LAST_DATE_WORKED_BeforeUpdate_Exit:
Exit Sub

LAST_DATE_WORKED_BeforeUpdate_Err:
MsgBox Error$
Resume LAST_DATE_WORKED_BeforeUpdate_Exit

End Sub


'------------------------------------------------------------
' Form_BeforeUpdate
'
'------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Form_BeforeUpdate_Err

' Last date that record was modified
Forms![CUSTOMER DATA]![LAST DATE WORKED] = DATE
' Last time that record was modified
Forms![CUSTOMER DATA]![LAST TIME MODIFIED] = Time()
' Adds a value to "Contact" field on update
Forms![CUSTOMER DATA]!CONTACT = CONTACT + 1


Form_BeforeUpdate_Exit:
Exit Sub

Form_BeforeUpdate_Err:
MsgBox Error$
Resume Form_BeforeUpdate_Exit

End Sub
 
Is there any other way to have the "contact," "Lastdatemodified," and the
"Lasttimemodified" fields update after each record is modified in my DAP?
Please let me know what I can do; I am really struggling with this one.

Thanks so much for your time.
 
Ok, good news; I figured out the date and time modified fields, but i am
still having trouble with the syntax of the CONTACT field to add 1 every
time the record is updated properly in the DAP. Please let me know if anyone
has a solution.

Thanks again and I apologize for being a bother.
 
Please disregard; I have figured out a solution. The problem was that I was
pointing to the field "CONTACT" properly, but not the "Value" of the field to
add the expression +1.
 
Back
Top