Currently I am running a database in order to keep track of projects. One of the fields in the project tracking is a bit of code which tells me (if someone changes the records) who changed it and when. I am currently running some code to do this but i keep getting an error
my code:
Private Sub Form_AfterUpdat e()
Me.LastModified = DateValue(Now() )
Me.By = MODBY
Me.Refresh
End Sub
me.by is where the name should be. MODBY is a variable dimensioned globally in a module. The value for MODBY is assigned in another form. code for MODBY:
Public MODBY As String **this is declared in the module**
Private Sub form_current() **Mind you this is in a different form**
MODBY = TxtUser.Value
end sub
Im getting two problems. First it tells me that MODBY has a "zero-string" value. But I have checked the value of MODBY before loading the project entry form with a msgbox and it tells me the value that i should be getting.
My second problem occurs when the afterupdate code is run. It reads as the following:
"Run time error '2115':
The macro or function set to the Beforeupdate or Validation Rule property for this field is preventing Microsoft Office Access from saving data in the field.
I am lost. I've tried for the last 3 hours yesterday and still can't firgure it out. Thanks.
my code:
Private Sub Form_AfterUpdat e()
Me.LastModified = DateValue(Now() )
Me.By = MODBY
Me.Refresh
End Sub
me.by is where the name should be. MODBY is a variable dimensioned globally in a module. The value for MODBY is assigned in another form. code for MODBY:
Public MODBY As String **this is declared in the module**
Private Sub form_current() **Mind you this is in a different form**
MODBY = TxtUser.Value
end sub
Im getting two problems. First it tells me that MODBY has a "zero-string" value. But I have checked the value of MODBY before loading the project entry form with a msgbox and it tells me the value that i should be getting.
My second problem occurs when the afterupdate code is run. It reads as the following:
"Run time error '2115':
The macro or function set to the Beforeupdate or Validation Rule property for this field is preventing Microsoft Office Access from saving data in the field.
I am lost. I've tried for the last 3 hours yesterday and still can't firgure it out. Thanks.
Comment