Adding User ID to Notes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have a subform on my data entry form titled Notes. It is able to capture
free format notes and date stamps the notes. I want to have the user ID that
entered the notes/ comments to be captured. I have the sub form set up as
follows:-

1.Text box for free format data (Which is working)
2.Text box for date field (which is working)
3.Text box titled user ID (which is not working)

I have set up user names ETC and everyone who uses the data base must login
with their own user name and pass word.

Can this be done???
 
Sam,

Put this in the user ID text box's Default Value property:

[application].[currentuser]

HTH,
Nikos
 
Thanks Nikos

The code now places the user name of the person, but it places the user name
on all notes. Even ones that were already there. Is there a way to only
record the user name for the note that the user is actually writing and leave
the others as is???

Thanks
 
Sam,

A control's Defaθlt value property will only "propose" a value if there
isn't one already there, it will not overwrite existing ones... unless
your problem is that the field is not populated in existing records? In
the latter case, the obvious solution is to populate the field in
existing records, either with the actual user name, or, if not possible,
with something like "unknown".

There is, of course, the possibility to drop altohether the Default
Value property of the control, and use some simple code in the form's On
Current event, to populate the control only upon entering a new record.
Your code wouled look something like:

Private Sub Form_Current()
If Me.NewRecord Then Me.txtUsername = Application.CurrentUser
End Sub

where I have assumed the control name to be txtUsername; change to the
actual name.

HTH,
Nikos
 
Nikos

I have added a bound text field to the note form and it now works fine!

Thanks for your help
 
Back
Top