Rabu, 28 September 2016

Re: [MS_AccessPros] Create row user log

 

Thank You Duane, I will give that a shot. I will have to put it on hold for now. Bigger project to take care of.


Jim Wagner


On Wednesday, September 28, 2016 10:22 AM, "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:


 
Jim,

Me.txtUser.DefaultValue = """" & Environ("UserName") & """" 

I don't have a clue regarding the code to add new record.

Duane Hookom



From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of Jim Wagner luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Wednesday, September 28, 2016 11:39 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Create row user log
 


Duane

So I tried that. I clicked the add new record button and no new record is added and the text box control shows #Name?


 
Jim Wagner


On Wednesday, September 28, 2016 9:26 AM, "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:


 
Jim,

Consider setting the default value of the text box to the user rather than the value. 

Duane Hookom, MVP
MS Access



From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Wednesday, September 28, 2016 11:14 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Create row user log
 


Hello all,

We have a database that has 1 backend and 6 frontends. Someone keeps adding a blank record and no one is admitting it. I believe that it is either a bug or probably user error. I opt to think that it is user error.

I would like to create a user log for any new record being added to the table. I have part of the solution but a piece of the parts is doing something I am unsure of.

On the form load event for the form I have the following code to populate a text box named txtUser with the user log. this works wonderful. The issue is when I click the add new button on the form the record is added and the date and the log in are populated, but the txtUser control goes blank. I am then unable to use the add new record button to get the data to put in the table. I am unable to explain why the text goes away.
I added the same code for the environ to the form load event also and the text disappears in the control.

Is there something I am missing or I am on the wrong track going to the wrong town?

Thank You

Jim Wagner

Form Load Event

Private Sub Form_Load()

Me.txtUser = Environ("UserName")

End Sub

__________________________________

On the before update event of the form I have the following code

Private Sub Form_BeforeUpdate(Cancel As Integer)

CurrentDb.Execute "INSERT INTO [Essential Functions] (DateofEdit, User) " & _
   "Values(Date() + Time(),  '" & Me.txtUser.Value & "')", dbFailOnError
  
   Me.txtUser = Environ("UserName")

  
End Sub








__._,_.___

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 (5)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar