Force update of field before record is saved

tuisb3

Registered User.
Local time
Today, 13:27
Joined
Aug 1, 2013
Messages
14
Hi,

I am new to this forum today and this is my 2nd question already!

Apologies if this is very simple but how can I force a field in a form to be updated before the record is saved / changed?

For instance I have a form with information on it and I want to ensure that any time the form is updated the user fills in a section providing the date and by who it has been updated by. I dont want the record to save unless that information has been filled out, and I also want it to take you to the field if you press save and it hasnt been filled out along with an error message.

Does this make sense?

To try and be a bit clearer.
At current I have a Save and New button. This saves the form if dirty and opens a new record.

I want to add in the step that if record has been changed and FieldA has not just been updated then go to fieldA (Showing a message box). If FieldA has just been updated then save record and open new as normal.

My current save & new button properties are as follows (in Macro Editor)

On error Go To Next
If [form].[dirty]
RunMenuCommand Command SaveRecord
End If
If [MacroError].[Number}< >0
Message =[MacroError].[Description]
Beep Yes
Type None
Stop macro
On Error
Go To Fail
Go To Record
Record New
Go To Control
Control name Resort Code


Many thanks in advance

(Also as I am new here how do I mark a post as being solved? Someone solved a question forme earlier and wasnt sure how to mark the post solved)

Steve
 
Last edited:
you can add:

Code:
If IsNull(mycontrol) Or mycontrol = "" Then
    Me.mycontrol.SetFocus
    Me.mycontrol.BackColor = vbYellow
    MsgBox "Please enter a value in the highlighted box"
    Exit Sub
Else
    Me.mycontrol.BackColor = vbWhite
End If
 
you could add the stuff you want automatically "behoind the scenes"

in the forms beforeupdate event just set your fields with these.

dateentered = now 'date plus time - just use date, if you want date only
enteredby = environ("username")
 
Thanks very much to both of you.

Gemma-the-Husky... How would i then call on this information if I need to. Is there a log file stored with this or something? Also the "username" is that taken from the current user that is logged into windows?

Many thanks

Steve
 

Users who are viewing this thread

Back
Top Bottom