Sabtu, 16 April 2016

Re: [MS_AccessPros] Insert Statement

 

Darrell

Thank You very much. 
 
Jim Wagner


On Friday, April 15, 2016 1:16 PM, "'Embrey, Darrell' DEmbrey@bcbsm.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:


 
CurrentDb.Execute "INSERT INTO tblTransferDate (TransferDate, ButtonClicked, FinalObject, UserLoggedIn) " & _
   "Values(Date() + Time(), 'cmdAddEmployee', 'Add New Record', '" & Me.txtUser.value & "')", dbFailOnError
 
 
Darrell
 
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Friday, April 15, 2016 3:30 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Insert Statement
 
 
Hello all,
 
I have an insert statement in vba that allows me to log when a couple of buttons are clicked and some other information related to it. I was thinking of adding one more function to the insert statement. I want to add the users logged name from a text box I have on a form. the name of the text box is txtUser and the On form load is the following to populate the txtUser control
 
Private Sub Form_Load()
Me.txtUser = Environ("UserName")
End Sub
 
Currently the code is
 
CurrentDb.Execute "INSERT INTO tblTransferDate (TransferDate, ButtonClicked, FinalObject) " & _
   "Values(Date() + Time(), 'cmdAddEmployee', 'Add New Record')", dbFailOnError
 
 
 
But I would like to add the value from the txtUser control but I cannot find a way to add the control. I get an error when I try the below code. Run-time error 3061 too few parameters. Expected 1
 
CurrentDb.Execute "INSERT INTO tblTransferDate (TransferDate, ButtonClicked, FinalObject, UserLoggedIn) " & _
   "Values(Date() + Time(), 'cmdAddEmployee', 'Add New Record', Me.txtUser.value)", dbFailOnError
 
 
How do I add that text control to the insert statement.
 
Thank You Very Much
 
Jim Wagner

The information contained in this communication is highly confidential and is intended solely for the use of the individual(s) to whom this communication is directed. If you are not the intended recipient, you are hereby notified that any viewing, copying, disclosure or distribution of this information is prohibited. Please notify the sender, by electronic mail or telephone, of any unintended receipt and delete the original message without making any copies.
Blue Cross Blue Shield of Michigan and Blue Care Network of Michigan are nonprofit corporations and independent licensees of the Blue Cross and Blue Shield Association.


__._,_.___

Posted by: Jim Wagner <luvmymelody@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (20)

.

__,_._,___

Tidak ada komentar:

Poskan Komentar