AutoFill Field On Open with Login Name

SoxPats83

Registered User.
Local time
Today, 01:43
Joined
May 7, 2010
Messages
196
I have an interesting one here. i am using the Tasks database template with MS Access 2007 and when a user selects a task to open, the Task Details forms pops up. the question i have is, would it be possible to auto populate the assigned uper box with the user's computer login?

thoughts?
 
What do you mean by assigned uper box?
 
I got some help from the group a few months back. I have a security lookup table that I tied their User ID name to. Here is the code I used. I'm not sure if this will help:
Textbox is txtusernm
My lookup table is dbo_AdminTable
the looks up fields are UserName and RecID

Me.txtusernm = Nz(DLookup("[UserName]", "dbo_AdminTable", "[RecID]=" & Chr(34) & GetUser() & Chr(34)), "")

I hope this helps.
 
i like all of the suggestions here, but the problem i am running into, i would like this to be a required field, but given the way i populate the table, this won't work for me. if the user open the form, the "Assigned To" field should populate with their log in. but i do not want to change the control source or anything, so this information gets relayed back to the table.
 
I'm not too sure but can't you just set the default value on that text box in your table, to the code, i.e. =GetUser()
That way it automatically populates the form, thus the table?
 
I'm not too sure but can't you just set the default value on that text box in your table, to the code, i.e. =GetUser()
That way it automatically populates the form, thus the table?
Sorry, invalid expression in the table design view.
 
an alternative i have come up for this is making the control a combobox and making the user input something into it. problem is if i import all of the tasks into the table (not knowing who will be doing which ones at that time) the reuired field in the table design view causes problems. what i am looking for now is that if the user ipens the form for edit, and any changes are made, then they must select something from this dropdown.
 
Use two textboxes. One with the Control Source set to =fOSUserName() which is what ghudson gave you. Make this textbox hidden. Then refer to the value of the textbox.
 
Use two textboxes. One with the Control Source set to =fOSUserName() which is what ghudson gave you. Make this textbox hidden. Then refer to the value of the textbox.
maybe i am having a bad day, but i am still at a loss here...
 
sorry, i have the module in place and the second text box with the =fOSUserName() in place. problem is, how do i reference this to the original text box so not to compromise the control source??
 
Set the value of the textbox when you need it using the VALUE property.

MyTxtbox.Value = UserNameTextbox.value
 
i trye to type out the code in VBA in the on open event and get a message saying that i cannot add a value to this box. kinda odd...
 

Users who are viewing this thread

Back
Top Bottom