Adding a Username to a Transaction from a Form

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

Guest

I have a continuous form called “Ledger Transactions to be deleted†that
displays one or more transactions for a given client.

The user can set a flag on a selected transaction to denote that the
transaction is to be marked for deletion.

I want the system to attach the name of the user to the transaction.

The username is a field on the transaction record and is on the “Ledger
Transactions to be deleted" form, but is not visible.

The username is recorded on a form called "Welcome Menu".

I assume I could use the Setvalue action to populate the username field on
Delete Transaction i.e. [Forms]![Ledger Transactions to be
deleted]![Username], [Forms]![Welcome Menu]![Username]

However, where should I put the Setvalue Action? I tried putting the
Setvalue Action
on the Gotfocus event on the Username field, but this does not seem to work.

Secondly I have a table called Username, which holds a single record
containing the username. This record is changed when the user enters his/her
name on the Welcome Menu.
I would prefer to add the username to the [Forms]![Ledger Transactions to be
deleted]![Username] field by accessing the Username table, rather than
leaving the Welcome Menu open. How could this be done?
 
Instead of closing the Welcome Menu, just hide it by setting the form's
visible property to false. A command button can be labeled to close, but
actually just hide the form. Code would be something like:

Sub cmdClose_Click()
Me.Visible = False
End Sub

Now you can simply refer to the textbox on the Welcome Menu:

Sub Form_AfterUpdate()
Me.txtUserName = Forms![Welcome Menu]!txtUserName
End Sub
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
Back
Top