Can't return function value to table?

dax1226

Registered User.
Local time
Today, 05:42
Joined
Dec 21, 2007
Messages
16
I have a form that I need to return the value of a fOSUserName() function back to the table so that I know the username of the person who last updated a record. I have been able to display the username on the form with the function, but have not been able to figure out how to assign the value of that function to the actual "Updated" field in the table.

Any assistance would be greatly appreciated.
 
Just do this - In the Before Update event of the form put

Me.YourLastUpdatedByTextBoxNameHere = fOSUserName

(no parens after fOSUserName needed).
 
Bob,

When doing that I received the following error in running the actual form "Microsoft Office Access can't find the macro 'Me'."



Just do this - In the Before Update event of the form put

Me.YourLastUpdatedByTextBoxNameHere = fOSUserName

(no parens after fOSUserName needed).
 
What is this - WFH_Actives ?

That's my table. If I just do:
Private Sub Form_Current()
Me.Updated = fOSUserName
End Sub

Then I get:
Compile Error
Method or data member not found.
 
You need to have a control on the form bound to the field "Updated" for Me.Updated = fOSUserName to work.

You can't reference a table like that in VBA.

So, add a control (you can set its visible property to NO if you don't want it seen) to the form and call it txtUpdated, bind it to the field Updated and then use:

Me.txtUpdated = fOSUserName
 
Finally!

Thank you so much for your extremely prompt response and patience! :D


You need to have a control on the form bound to the field "Updated" for Me.Updated = fOSUserName to work.

You can't reference a table like that in VBA.

So, add a control (you can set its visible property to NO if you don't want it seen) to the form and call it txtUpdated, bind it to the field Updated and then use:

Me.txtUpdated = fOSUserName
 
WOO HOO!! I'm glad we finally got that working for you. :)

Glad to be able to help!
 

Users who are viewing this thread

Back
Top Bottom