|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Understandable documentation regarding Access DBA securityHi all, and thanks for this great place...! Were can i find a easy to read,
step by step documentation on how i set up the database security. I am now more or less ready with my application and i intend to splitt it into a front- and back end. 10 users. The back end resides on a shared drive. All i need is for each user to log in with his/her username and PW. This is important since i also have a module that "picks up" the username and populates the fOSUserName controll... Thanks! Unfortunately, Access User-Level Security isn't a simple proposition.
The most comprehensive document is http://support.microsoft.com/support/access/content/secfaq.asp Make sure you read it thoroughly several times before starting, work on a copy of your database (just in case!) and make sure you don't leave out any steps. -- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:03076C80-3A94-470E-B79F-438454AB06EC@microsoft.com... > Hi all, and thanks for this great place...! Were can i find a easy to > read, > step by step documentation on how i set up the database security. I am now > more or less ready with my application and i intend to splitt it into a > front- and back end. 10 users. The back end resides on a shared drive. All > i > need is for each user to log in with his/her username and PW. This is > important since i also have a module that "picks up" the username and > populates the fOSUserName controll... > > Thanks! Hi again...this documentation refers to Access 2.0-2000..i use 2003..is it
valid for me? Thanks! Show quoteHide quote "Douglas J. Steele" wrote: > Unfortunately, Access User-Level Security isn't a simple proposition. > > The most comprehensive document is > http://support.microsoft.com/support/access/content/secfaq.asp Make sure you > read it thoroughly several times before starting, work on a copy of your > database (just in case!) and make sure you don't leave out any steps. > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "Peter" <Pe***@discussions.microsoft.com> wrote in message > news:03076C80-3A94-470E-B79F-438454AB06EC@microsoft.com... > > Hi all, and thanks for this great place...! Were can i find a easy to > > read, > > step by step documentation on how i set up the database security. I am now > > more or less ready with my application and i intend to splitt it into a > > front- and back end. 10 users. The back end resides on a shared drive. All > > i > > need is for each user to log in with his/her username and PW. This is > > important since i also have a module that "picks up" the username and > > populates the fOSUserName controll... > > > > Thanks! > > > Yes. Nothing changed with respect to ULS in Access 2002 or Access 2003 or
MDB files in Access 2007. -- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:72201A5F-964A-4354-8F9B-4D8EF22C686C@microsoft.com... > Hi again...this documentation refers to Access 2.0-2000..i use 2003..is it > valid for me? > > Thanks! > > "Douglas J. Steele" wrote: > >> Unfortunately, Access User-Level Security isn't a simple proposition. >> >> The most comprehensive document is >> http://support.microsoft.com/support/access/content/secfaq.asp Make sure >> you >> read it thoroughly several times before starting, work on a copy of your >> database (just in case!) and make sure you don't leave out any steps. >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele >> (no private e-mails, please) >> >> >> "Peter" <Pe***@discussions.microsoft.com> wrote in message >> news:03076C80-3A94-470E-B79F-438454AB06EC@microsoft.com... >> > Hi all, and thanks for this great place...! Were can i find a easy to >> > read, >> > step by step documentation on how i set up the database security. I am >> > now >> > more or less ready with my application and i intend to splitt it into a >> > front- and back end. 10 users. The back end resides on a shared drive. >> > All >> > i >> > need is for each user to log in with his/her username and PW. This is >> > important since i also have a module that "picks up" the username and >> > populates the fOSUserName controll... >> > >> > Thanks! >> >> >> Peter <Pe***@discussions.microsoft.com> wrote:
>Hi all, and thanks for this great place...! Were can i find a easy to read, Why not just use the network user id? API: Get Login name>step by step documentation on how i set up the database security. I am now >more or less ready with my application and i intend to splitt it into a >front- and back end. 10 users. The back end resides on a shared drive. All i >need is for each user to log in with his/her username and PW. This is >important since i also have a module that "picks up" the username and >populates the fOSUserName controll... http://www.mvps.org/access/api/api0008.htm Do you really need to secure the objects within the MDB file, either FE or BE? Tony -- Tony Toews, Microsoft Access MVP Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ Granite Fleet Manager http://www.granitefleet.com/ Hi Tony...:-)..here is what i need..
"/Hi again...i have an issue with "picking up" the username of the Windows system. http://www.mvps.org/access/api/api0008.htm. I copied the whole code and i pasted it in a module (Module1) this is how it looks: Option Compare Database ' This code was originally written by Dev Ashish. ' It is not to be altered or distributed, ' except as part of an application. ' You are free to use it in any application, ' provided the copyright notice is left unchanged. ' ' Code Courtesy of ' Dev Ashish ' Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long ______________________________________________________________ Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If (lngX > 0) Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = vbNullString End If End Function I followed the conversation Subject: Re: Returning current user from SQLServer And the bottom line is, this is what i need. I want the username to be posted on my opening form (whiwch is always open when the application runs) in order to refer to it later. I have created a textbox, "Username". On the opening event of my form i use DoCmd.Maximize...were do i put Me.txtUserName = fOSUserName???? fOSUserName is part of my client table...whoever creates or modifies a record will be populated here... I appologize for my ignorance :-) Show quoteHide quote "Tony Toews [MVP]" wrote: > Peter <Pe***@discussions.microsoft.com> wrote: > > >Hi all, and thanks for this great place...! Were can i find a easy to read, > >step by step documentation on how i set up the database security. I am now > >more or less ready with my application and i intend to splitt it into a > >front- and back end. 10 users. The back end resides on a shared drive. All i > >need is for each user to log in with his/her username and PW. This is > >important since i also have a module that "picks up" the username and > >populates the fOSUserName controll... > > Why not just use the network user id? API: Get Login name > http://www.mvps.org/access/api/api0008.htm > > Do you really need to secure the objects within the MDB file, either > FE or BE? > > Tony > -- > Tony Toews, Microsoft Access MVP > Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm > Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > Granite Fleet Manager http://www.granitefleet.com/ > Is textbox txtUserName bound to a field in the form's recordsource (i.e.:
you can to save it to a table), or are you simply trying to display it? If the latter (you're simply trying to display it), just set the text box's ControlSource property to\ = fOSUserName() (including the equal sign) If the former, put your code in the form's Load event. -- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:176BE3DA-DE28-4879-845D-4341A2EB0BE4@microsoft.com... > Hi Tony...:-)..here is what i need.. > > "/Hi again...i have an issue with "picking up" the username of the Windows > system. > > http://www.mvps.org/access/api/api0008.htm. I copied the whole code and i > pasted it in a module (Module1) this is how it looks: > > Option Compare Database > > ' This code was originally written by Dev Ashish. > ' It is not to be altered or distributed, > ' except as part of an application. > ' You are free to use it in any application, > ' provided the copyright notice is left unchanged. > ' > ' Code Courtesy of > ' Dev Ashish > ' > Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ > "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long > ______________________________________________________________ > Function fOSUserName() As String > ' Returns the network login name > Dim lngLen As Long, lngX As Long > Dim strUserName As String > strUserName = String$(254, 0) > lngLen = 255 > lngX = apiGetUserName(strUserName, lngLen) > If (lngX > 0) Then > fOSUserName = Left$(strUserName, lngLen - 1) > Else > fOSUserName = vbNullString > End If > End Function > > I followed the conversation Subject: Re: Returning current user from > SQLServer > > And the bottom line is, this is what i need. I want the username to be > posted on my opening form (whiwch is always open when the application > runs) > in order to refer to it later. I have created a textbox, "Username". On > the > opening event of my form i use DoCmd.Maximize...were do i put > Me.txtUserName > = fOSUserName???? > > fOSUserName is part of my client table...whoever creates or modifies a > record will be populated here... > > I appologize for my ignorance :-) > > > > > "Tony Toews [MVP]" wrote: > >> Peter <Pe***@discussions.microsoft.com> wrote: >> >> >Hi all, and thanks for this great place...! Were can i find a easy to >> >read, >> >step by step documentation on how i set up the database security. I am >> >now >> >more or less ready with my application and i intend to splitt it into a >> >front- and back end. 10 users. The back end resides on a shared drive. >> >All i >> >need is for each user to log in with his/her username and PW. This is >> >important since i also have a module that "picks up" the username and >> >populates the fOSUserName controll... >> >> Why not just use the network user id? API: Get Login name >> http://www.mvps.org/access/api/api0008.htm >> >> Do you really need to secure the objects within the MDB file, either >> FE or BE? >> >> Tony >> -- >> Tony Toews, Microsoft Access MVP >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ >> Granite Fleet Manager http://www.granitefleet.com/ >> Peter <Pe***@discussions.microsoft.com> wrote:
>And the bottom line is, this is what i need. I want the username to be That's what I was wondering. Rather than sending you way off into the>posted on my opening form (whiwch is always open when the application runs) >in order to refer to it later. complex world of Access security. And I see Douglas has replied. >I appologize for my ignorance :-) We don't mind ignorance because we like helping. So continue to askaway. Tony -- Tony Toews, Microsoft Access MVP Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ Granite Fleet Manager http://www.granitefleet.com/ Ok Tony...i am using this
Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err ' Set bound controls to system date and time and current user name. Me.DateModified = Date Me.TimeModified = Time() Me.fOSUserName = fOSUserName() BeforeUpdate_End: Exit Sub BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ "Error Number " & Err.Number & " Occurred" Resume BeforeUpdate_End End Sub The module to pick up the API code is in place...but the bound controll is still not populated i use the above code on a Before Update event for the Form..and the time and date functions....i beleive i am doing something very wrong.. Show quoteHide quote "Tony Toews [MVP]" wrote: > Peter <Pe***@discussions.microsoft.com> wrote: > > >And the bottom line is, this is what i need. I want the username to be > >posted on my opening form (whiwch is always open when the application runs) > >in order to refer to it later. > > That's what I was wondering. Rather than sending you way off into the > complex world of Access security. > > And I see Douglas has replied. > > >I appologize for my ignorance :-) > > We don't mind ignorance because we like helping. So continue to ask > away. > > Tony > -- > Tony Toews, Microsoft Access MVP > Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm > Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > Granite Fleet Manager http://www.granitefleet.com/ > Try using something other than fOSUserName as the name of the text box. The
ambiguity is probably confusing Access. -- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... > Ok Tony...i am using this > > Private Sub Form_BeforeUpdate(Cancel As Integer) > On Error GoTo BeforeUpdate_Err > > ' Set bound controls to system date and time and current user name. > Me.DateModified = Date > Me.TimeModified = Time() > Me.fOSUserName = fOSUserName() > BeforeUpdate_End: > Exit Sub > BeforeUpdate_Err: > MsgBox Err.Description, vbCritical & vbOKOnly, _ > "Error Number " & Err.Number & " Occurred" > Resume BeforeUpdate_End > End Sub > > The module to pick up the API code is in place...but the bound controll is > still not populated i use the above code on a Before Update event for the > Form..and the time and date functions....i beleive i am doing something > very > wrong.. > > "Tony Toews [MVP]" wrote: > >> Peter <Pe***@discussions.microsoft.com> wrote: >> >> >And the bottom line is, this is what i need. I want the username to be >> >posted on my opening form (whiwch is always open when the application >> >runs) >> >in order to refer to it later. >> >> That's what I was wondering. Rather than sending you way off into the >> complex world of Access security. >> >> And I see Douglas has replied. >> >> >I appologize for my ignorance :-) >> >> We don't mind ignorance because we like helping. So continue to ask >> away. >> >> Tony >> -- >> Tony Toews, Microsoft Access MVP >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ >> Granite Fleet Manager http://www.granitefleet.com/ >> Hoping you are a person of great patiance...-:)..
Nope..if i use the below code..it does not update my bounded Operator text field with the current user when i edit this specific record... If i set the control source to = fOSUserName() it populates this text field...but regardless if the record is editet or not..just by opening it... I need to know whois the last person that edited the record...the time and date functions well..displays the current date/time the record was edited...after that i exit the record...thats ok Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err ' Set bound controls to system date and time and current user name. Me.DateModified = Date Me.TimeModified = Time() Me.Operator = fOSUserName() BeforeUpdate_End: Exit Sub BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ "Error Number " & Err.Number & " Occurred" Resume BeforeUpdat Show quoteHide quote "Douglas J. Steele" wrote: > Try using something other than fOSUserName as the name of the text box. The > ambiguity is probably confusing Access. > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "Peter" <Pe***@discussions.microsoft.com> wrote in message > news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... > > Ok Tony...i am using this > > > > Private Sub Form_BeforeUpdate(Cancel As Integer) > > On Error GoTo BeforeUpdate_Err > > > > ' Set bound controls to system date and time and current user name. > > Me.DateModified = Date > > Me.TimeModified = Time() > > Me.fOSUserName = fOSUserName() > > BeforeUpdate_End: > > Exit Sub > > BeforeUpdate_Err: > > MsgBox Err.Description, vbCritical & vbOKOnly, _ > > "Error Number " & Err.Number & " Occurred" > > Resume BeforeUpdate_End > > End Sub > > > > The module to pick up the API code is in place...but the bound controll is > > still not populated i use the above code on a Before Update event for the > > Form..and the time and date functions....i beleive i am doing something > > very > > wrong.. > > > > "Tony Toews [MVP]" wrote: > > > >> Peter <Pe***@discussions.microsoft.com> wrote: > >> > >> >And the bottom line is, this is what i need. I want the username to be > >> >posted on my opening form (whiwch is always open when the application > >> >runs) > >> >in order to refer to it later. > >> > >> That's what I was wondering. Rather than sending you way off into the > >> complex world of Access security. > >> > >> And I see Douglas has replied. > >> > >> >I appologize for my ignorance :-) > >> > >> We don't mind ignorance because we like helping. So continue to ask > >> away. > >> > >> Tony > >> -- > >> Tony Toews, Microsoft Access MVP > >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm > >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > >> Granite Fleet Manager http://www.granitefleet.com/ > >> > > > So you're saying that the DateModified and TimeModified fields are being
updated (why are you storing them in separate fields, btw? You should have a single field and populate it using the Now function), but that Operator isn't? That makes no sense. For debugging purposes, try the following: Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ "fOSUserName = " & fOSUserName() ' Set bound controls to system date and time and current user name. Me.DateModified = Date Me.TimeModified = Time() Me.Operator = fOSUserName() MsgBox "After: Operator " & Me.Operator & vbCrLf & _ "(" & Me.DateModified & " " & Me.TimeModified & ")" BeforeUpdate_End: Exit Sub BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ "Error Number " & Err.Number & " Occurred" Resume BeforeUpdate_End End Sub -- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... > Hoping you are a person of great patiance...-:).. > > Nope..if i use the below code..it does not update my bounded Operator text > field with the current user when i edit this specific record... > > If i set the control source to = fOSUserName() it populates this text > field...but regardless if the record is editet or not..just by opening > it... > > I need to know whois the last person that edited the record...the time and > date functions well..displays the current date/time the record was > edited...after that i exit the record...thats ok > > Private Sub Form_BeforeUpdate(Cancel As Integer) > On Error GoTo BeforeUpdate_Err > > ' Set bound controls to system date and time and current user name. > Me.DateModified = Date > Me.TimeModified = Time() > Me.Operator = fOSUserName() > BeforeUpdate_End: > Exit Sub > BeforeUpdate_Err: > MsgBox Err.Description, vbCritical & vbOKOnly, _ > "Error Number " & Err.Number & " Occurred" > Resume BeforeUpdat > > "Douglas J. Steele" wrote: > >> Try using something other than fOSUserName as the name of the text box. >> The >> ambiguity is probably confusing Access. >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele >> (no private e-mails, please) >> >> >> "Peter" <Pe***@discussions.microsoft.com> wrote in message >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... >> > Ok Tony...i am using this >> > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) >> > On Error GoTo BeforeUpdate_Err >> > >> > ' Set bound controls to system date and time and current user name. >> > Me.DateModified = Date >> > Me.TimeModified = Time() >> > Me.fOSUserName = fOSUserName() >> > BeforeUpdate_End: >> > Exit Sub >> > BeforeUpdate_Err: >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> > "Error Number " & Err.Number & " Occurred" >> > Resume BeforeUpdate_End >> > End Sub >> > >> > The module to pick up the API code is in place...but the bound controll >> > is >> > still not populated i use the above code on a Before Update event for >> > the >> > Form..and the time and date functions....i beleive i am doing something >> > very >> > wrong.. >> > >> > "Tony Toews [MVP]" wrote: >> > >> >> Peter <Pe***@discussions.microsoft.com> wrote: >> >> >> >> >And the bottom line is, this is what i need. I want the username to >> >> >be >> >> >posted on my opening form (whiwch is always open when the application >> >> >runs) >> >> >in order to refer to it later. >> >> >> >> That's what I was wondering. Rather than sending you way off into the >> >> complex world of Access security. >> >> >> >> And I see Douglas has replied. >> >> >> >> >I appologize for my ignorance :-) >> >> >> >> We don't mind ignorance because we like helping. So continue to ask >> >> away. >> >> >> >> Tony >> >> -- >> >> Tony Toews, Microsoft Access MVP >> >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ >> >> Granite Fleet Manager http://www.granitefleet.com/ >> >> >> >> >> When i replace my code with yours i receive two small popups after exiting
the record..i did some edits 1. Before: Operator (29/05/2009 17:51:48) fOSUername = 2. After: Operator (29/05/2009 17:54:16) Show quoteHide quote "Douglas J. Steele" wrote: > So you're saying that the DateModified and TimeModified fields are being > updated (why are you storing them in separate fields, btw? You should have a > single field and populate it using the Now function), but that Operator > isn't? That makes no sense. > > For debugging purposes, try the following: > > Private Sub Form_BeforeUpdate(Cancel As Integer) > On Error GoTo BeforeUpdate_Err > > MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ > "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ > "fOSUserName = " & fOSUserName() > > ' Set bound controls to system date and time and current user name. > Me.DateModified = Date > Me.TimeModified = Time() > Me.Operator = fOSUserName() > > MsgBox "After: Operator " & Me.Operator & vbCrLf & _ > "(" & Me.DateModified & " " & Me.TimeModified & ")" > > BeforeUpdate_End: > Exit Sub > > BeforeUpdate_Err: > MsgBox Err.Description, vbCritical & vbOKOnly, _ > "Error Number " & Err.Number & " Occurred" > Resume BeforeUpdate_End > > End Sub > > > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "Peter" <Pe***@discussions.microsoft.com> wrote in message > news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... > > Hoping you are a person of great patiance...-:).. > > > > Nope..if i use the below code..it does not update my bounded Operator text > > field with the current user when i edit this specific record... > > > > If i set the control source to = fOSUserName() it populates this text > > field...but regardless if the record is editet or not..just by opening > > it... > > > > I need to know whois the last person that edited the record...the time and > > date functions well..displays the current date/time the record was > > edited...after that i exit the record...thats ok > > > > Private Sub Form_BeforeUpdate(Cancel As Integer) > > On Error GoTo BeforeUpdate_Err > > > > ' Set bound controls to system date and time and current user name. > > Me.DateModified = Date > > Me.TimeModified = Time() > > Me.Operator = fOSUserName() > > BeforeUpdate_End: > > Exit Sub > > BeforeUpdate_Err: > > MsgBox Err.Description, vbCritical & vbOKOnly, _ > > "Error Number " & Err.Number & " Occurred" > > Resume BeforeUpdat > > > > "Douglas J. Steele" wrote: > > > >> Try using something other than fOSUserName as the name of the text box. > >> The > >> ambiguity is probably confusing Access. > >> > >> -- > >> Doug Steele, Microsoft Access MVP > >> http://I.Am/DougSteele > >> (no private e-mails, please) > >> > >> > >> "Peter" <Pe***@discussions.microsoft.com> wrote in message > >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... > >> > Ok Tony...i am using this > >> > > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > On Error GoTo BeforeUpdate_Err > >> > > >> > ' Set bound controls to system date and time and current user name. > >> > Me.DateModified = Date > >> > Me.TimeModified = Time() > >> > Me.fOSUserName = fOSUserName() > >> > BeforeUpdate_End: > >> > Exit Sub > >> > BeforeUpdate_Err: > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > "Error Number " & Err.Number & " Occurred" > >> > Resume BeforeUpdate_End > >> > End Sub > >> > > >> > The module to pick up the API code is in place...but the bound controll > >> > is > >> > still not populated i use the above code on a Before Update event for > >> > the > >> > Form..and the time and date functions....i beleive i am doing something > >> > very > >> > wrong.. > >> > > >> > "Tony Toews [MVP]" wrote: > >> > > >> >> Peter <Pe***@discussions.microsoft.com> wrote: > >> >> > >> >> >And the bottom line is, this is what i need. I want the username to > >> >> >be > >> >> >posted on my opening form (whiwch is always open when the application > >> >> >runs) > >> >> >in order to refer to it later. > >> >> > >> >> That's what I was wondering. Rather than sending you way off into the > >> >> complex world of Access security. > >> >> > >> >> And I see Douglas has replied. > >> >> > >> >> >I appologize for my ignorance :-) > >> >> > >> >> We don't mind ignorance because we like helping. So continue to ask > >> >> away. > >> >> > >> >> Tony > >> >> -- > >> >> Tony Toews, Microsoft Access MVP > >> >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm > >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > >> >> Granite Fleet Manager http://www.granitefleet.com/ > >> >> > >> > >> > >> > > > ...and the reson for the seperate Time Date fieled is this idea that i want to
caclulate the elapsed tome between time created and time modified in the future..just an experiment... Show quoteHide quote "Peter" wrote: > When i replace my code with yours i receive two small popups after exiting > the record..i did some edits > > 1. Before: Operator (29/05/2009 17:51:48) fOSUername = > 2. After: Operator (29/05/2009 17:54:16) > > "Douglas J. Steele" wrote: > > > So you're saying that the DateModified and TimeModified fields are being > > updated (why are you storing them in separate fields, btw? You should have a > > single field and populate it using the Now function), but that Operator > > isn't? That makes no sense. > > > > For debugging purposes, try the following: > > > > Private Sub Form_BeforeUpdate(Cancel As Integer) > > On Error GoTo BeforeUpdate_Err > > > > MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ > > "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ > > "fOSUserName = " & fOSUserName() > > > > ' Set bound controls to system date and time and current user name. > > Me.DateModified = Date > > Me.TimeModified = Time() > > Me.Operator = fOSUserName() > > > > MsgBox "After: Operator " & Me.Operator & vbCrLf & _ > > "(" & Me.DateModified & " " & Me.TimeModified & ")" > > > > BeforeUpdate_End: > > Exit Sub > > > > BeforeUpdate_Err: > > MsgBox Err.Description, vbCritical & vbOKOnly, _ > > "Error Number " & Err.Number & " Occurred" > > Resume BeforeUpdate_End > > > > End Sub > > > > > > > > -- > > Doug Steele, Microsoft Access MVP > > http://I.Am/DougSteele > > (no private e-mails, please) > > > > > > "Peter" <Pe***@discussions.microsoft.com> wrote in message > > news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... > > > Hoping you are a person of great patiance...-:).. > > > > > > Nope..if i use the below code..it does not update my bounded Operator text > > > field with the current user when i edit this specific record... > > > > > > If i set the control source to = fOSUserName() it populates this text > > > field...but regardless if the record is editet or not..just by opening > > > it... > > > > > > I need to know whois the last person that edited the record...the time and > > > date functions well..displays the current date/time the record was > > > edited...after that i exit the record...thats ok > > > > > > Private Sub Form_BeforeUpdate(Cancel As Integer) > > > On Error GoTo BeforeUpdate_Err > > > > > > ' Set bound controls to system date and time and current user name. > > > Me.DateModified = Date > > > Me.TimeModified = Time() > > > Me.Operator = fOSUserName() > > > BeforeUpdate_End: > > > Exit Sub > > > BeforeUpdate_Err: > > > MsgBox Err.Description, vbCritical & vbOKOnly, _ > > > "Error Number " & Err.Number & " Occurred" > > > Resume BeforeUpdat > > > > > > "Douglas J. Steele" wrote: > > > > > >> Try using something other than fOSUserName as the name of the text box. > > >> The > > >> ambiguity is probably confusing Access. > > >> > > >> -- > > >> Doug Steele, Microsoft Access MVP > > >> http://I.Am/DougSteele > > >> (no private e-mails, please) > > >> > > >> > > >> "Peter" <Pe***@discussions.microsoft.com> wrote in message > > >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... > > >> > Ok Tony...i am using this > > >> > > > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) > > >> > On Error GoTo BeforeUpdate_Err > > >> > > > >> > ' Set bound controls to system date and time and current user name. > > >> > Me.DateModified = Date > > >> > Me.TimeModified = Time() > > >> > Me.fOSUserName = fOSUserName() > > >> > BeforeUpdate_End: > > >> > Exit Sub > > >> > BeforeUpdate_Err: > > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ > > >> > "Error Number " & Err.Number & " Occurred" > > >> > Resume BeforeUpdate_End > > >> > End Sub > > >> > > > >> > The module to pick up the API code is in place...but the bound controll > > >> > is > > >> > still not populated i use the above code on a Before Update event for > > >> > the > > >> > Form..and the time and date functions....i beleive i am doing something > > >> > very > > >> > wrong.. > > >> > > > >> > "Tony Toews [MVP]" wrote: > > >> > > > >> >> Peter <Pe***@discussions.microsoft.com> wrote: > > >> >> > > >> >> >And the bottom line is, this is what i need. I want the username to > > >> >> >be > > >> >> >posted on my opening form (whiwch is always open when the application > > >> >> >runs) > > >> >> >in order to refer to it later. > > >> >> > > >> >> That's what I was wondering. Rather than sending you way off into the > > >> >> complex world of Access security. > > >> >> > > >> >> And I see Douglas has replied. > > >> >> > > >> >> >I appologize for my ignorance :-) > > >> >> > > >> >> We don't mind ignorance because we like helping. So continue to ask > > >> >> away. > > >> >> > > >> >> Tony > > >> >> -- > > >> >> Tony Toews, Microsoft Access MVP > > >> >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm > > >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > > >> >> Granite Fleet Manager http://www.granitefleet.com/ > > >> >> > > >> > > >> > > >> > > > > > > DateDiff works just as well with Date/Time as with Time only.
-- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:1F921D75-7B00-4730-886B-675A50E1D343@microsoft.com... > ..and the reson for the seperate Time Date fieled is this idea that i want > to > caclulate the elapsed tome between time created and time modified in the > future..just an experiment... > > "Peter" wrote: > >> When i replace my code with yours i receive two small popups after >> exiting >> the record..i did some edits >> >> 1. Before: Operator (29/05/2009 17:51:48) fOSUername = >> 2. After: Operator (29/05/2009 17:54:16) >> >> "Douglas J. Steele" wrote: >> >> > So you're saying that the DateModified and TimeModified fields are >> > being >> > updated (why are you storing them in separate fields, btw? You should >> > have a >> > single field and populate it using the Now function), but that Operator >> > isn't? That makes no sense. >> > >> > For debugging purposes, try the following: >> > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) >> > On Error GoTo BeforeUpdate_Err >> > >> > MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ >> > "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ >> > "fOSUserName = " & fOSUserName() >> > >> > ' Set bound controls to system date and time and current user name. >> > Me.DateModified = Date >> > Me.TimeModified = Time() >> > Me.Operator = fOSUserName() >> > >> > MsgBox "After: Operator " & Me.Operator & vbCrLf & _ >> > "(" & Me.DateModified & " " & Me.TimeModified & ")" >> > >> > BeforeUpdate_End: >> > Exit Sub >> > >> > BeforeUpdate_Err: >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> > "Error Number " & Err.Number & " Occurred" >> > Resume BeforeUpdate_End >> > >> > End Sub >> > >> > >> > >> > -- >> > Doug Steele, Microsoft Access MVP >> > http://I.Am/DougSteele >> > (no private e-mails, please) >> > >> > >> > "Peter" <Pe***@discussions.microsoft.com> wrote in message >> > news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... >> > > Hoping you are a person of great patiance...-:).. >> > > >> > > Nope..if i use the below code..it does not update my bounded Operator >> > > text >> > > field with the current user when i edit this specific record... >> > > >> > > If i set the control source to = fOSUserName() it populates this text >> > > field...but regardless if the record is editet or not..just by >> > > opening >> > > it... >> > > >> > > I need to know whois the last person that edited the record...the >> > > time and >> > > date functions well..displays the current date/time the record was >> > > edited...after that i exit the record...thats ok >> > > >> > > Private Sub Form_BeforeUpdate(Cancel As Integer) >> > > On Error GoTo BeforeUpdate_Err >> > > >> > > ' Set bound controls to system date and time and current user >> > > name. >> > > Me.DateModified = Date >> > > Me.TimeModified = Time() >> > > Me.Operator = fOSUserName() >> > > BeforeUpdate_End: >> > > Exit Sub >> > > BeforeUpdate_Err: >> > > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> > > "Error Number " & Err.Number & " Occurred" >> > > Resume BeforeUpdat >> > > >> > > "Douglas J. Steele" wrote: >> > > >> > >> Try using something other than fOSUserName as the name of the text >> > >> box. >> > >> The >> > >> ambiguity is probably confusing Access. >> > >> >> > >> -- >> > >> Doug Steele, Microsoft Access MVP >> > >> http://I.Am/DougSteele >> > >> (no private e-mails, please) >> > >> >> > >> >> > >> "Peter" <Pe***@discussions.microsoft.com> wrote in message >> > >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... >> > >> > Ok Tony...i am using this >> > >> > >> > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) >> > >> > On Error GoTo BeforeUpdate_Err >> > >> > >> > >> > ' Set bound controls to system date and time and current user >> > >> > name. >> > >> > Me.DateModified = Date >> > >> > Me.TimeModified = Time() >> > >> > Me.fOSUserName = fOSUserName() >> > >> > BeforeUpdate_End: >> > >> > Exit Sub >> > >> > BeforeUpdate_Err: >> > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> > >> > "Error Number " & Err.Number & " Occurred" >> > >> > Resume BeforeUpdate_End >> > >> > End Sub >> > >> > >> > >> > The module to pick up the API code is in place...but the bound >> > >> > controll >> > >> > is >> > >> > still not populated i use the above code on a Before Update event >> > >> > for >> > >> > the >> > >> > Form..and the time and date functions....i beleive i am doing >> > >> > something >> > >> > very >> > >> > wrong.. >> > >> > >> > >> > "Tony Toews [MVP]" wrote: >> > >> > >> > >> >> Peter <Pe***@discussions.microsoft.com> wrote: >> > >> >> >> > >> >> >And the bottom line is, this is what i need. I want the username >> > >> >> >to >> > >> >> >be >> > >> >> >posted on my opening form (whiwch is always open when the >> > >> >> >application >> > >> >> >runs) >> > >> >> >in order to refer to it later. >> > >> >> >> > >> >> That's what I was wondering. Rather than sending you way off >> > >> >> into the >> > >> >> complex world of Access security. >> > >> >> >> > >> >> And I see Douglas has replied. >> > >> >> >> > >> >> >I appologize for my ignorance :-) >> > >> >> >> > >> >> We don't mind ignorance because we like helping. So continue to >> > >> >> ask >> > >> >> away. >> > >> >> >> > >> >> Tony >> > >> >> -- >> > >> >> Tony Toews, Microsoft Access MVP >> > >> >> Tony's Main MS Access pages - >> > >> >> http://www.granite.ab.ca/accsmstr.htm >> > >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ >> > >> >> Granite Fleet Manager http://www.granitefleet.com/ >> > >> >> >> > >> >> > >> >> > >> >> > >> > >> > Yes Douglas. Unbound textbox with controll source =fOSUserName() works just
fine..perhaps i should just set an invisible textbox with =fOSUserName() and refer to that the following way: Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err ' Set bound controls to system date and time and current user name. Me.DateModified = Date Me.TimeModified = Time() Me.Username = Forms!Spider_reports.UserName The date BeforeUpdate_End: Exit Sub BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ "Error Number " & Err.Number & " Occurred" Resume BeforeUpdate_End End Sub I will deffently use the DateDiff in order to be able to calculate the time spent on a specific record...Thanks..well..step by step...day by day..:-) Show quoteHide quote "Douglas J. Steele" wrote: > DateDiff works just as well with Date/Time as with Time only. > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "Peter" <Pe***@discussions.microsoft.com> wrote in message > news:1F921D75-7B00-4730-886B-675A50E1D343@microsoft.com... > > ..and the reson for the seperate Time Date fieled is this idea that i want > > to > > caclulate the elapsed tome between time created and time modified in the > > future..just an experiment... > > > > "Peter" wrote: > > > >> When i replace my code with yours i receive two small popups after > >> exiting > >> the record..i did some edits > >> > >> 1. Before: Operator (29/05/2009 17:51:48) fOSUername = > >> 2. After: Operator (29/05/2009 17:54:16) > >> > >> "Douglas J. Steele" wrote: > >> > >> > So you're saying that the DateModified and TimeModified fields are > >> > being > >> > updated (why are you storing them in separate fields, btw? You should > >> > have a > >> > single field and populate it using the Now function), but that Operator > >> > isn't? That makes no sense. > >> > > >> > For debugging purposes, try the following: > >> > > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > On Error GoTo BeforeUpdate_Err > >> > > >> > MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ > >> > "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ > >> > "fOSUserName = " & fOSUserName() > >> > > >> > ' Set bound controls to system date and time and current user name. > >> > Me.DateModified = Date > >> > Me.TimeModified = Time() > >> > Me.Operator = fOSUserName() > >> > > >> > MsgBox "After: Operator " & Me.Operator & vbCrLf & _ > >> > "(" & Me.DateModified & " " & Me.TimeModified & ")" > >> > > >> > BeforeUpdate_End: > >> > Exit Sub > >> > > >> > BeforeUpdate_Err: > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > "Error Number " & Err.Number & " Occurred" > >> > Resume BeforeUpdate_End > >> > > >> > End Sub > >> > > >> > > >> > > >> > -- > >> > Doug Steele, Microsoft Access MVP > >> > http://I.Am/DougSteele > >> > (no private e-mails, please) > >> > > >> > > >> > "Peter" <Pe***@discussions.microsoft.com> wrote in message > >> > news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... > >> > > Hoping you are a person of great patiance...-:).. > >> > > > >> > > Nope..if i use the below code..it does not update my bounded Operator > >> > > text > >> > > field with the current user when i edit this specific record... > >> > > > >> > > If i set the control source to = fOSUserName() it populates this text > >> > > field...but regardless if the record is editet or not..just by > >> > > opening > >> > > it... > >> > > > >> > > I need to know whois the last person that edited the record...the > >> > > time and > >> > > date functions well..displays the current date/time the record was > >> > > edited...after that i exit the record...thats ok > >> > > > >> > > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > > On Error GoTo BeforeUpdate_Err > >> > > > >> > > ' Set bound controls to system date and time and current user > >> > > name. > >> > > Me.DateModified = Date > >> > > Me.TimeModified = Time() > >> > > Me.Operator = fOSUserName() > >> > > BeforeUpdate_End: > >> > > Exit Sub > >> > > BeforeUpdate_Err: > >> > > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > > "Error Number " & Err.Number & " Occurred" > >> > > Resume BeforeUpdat > >> > > > >> > > "Douglas J. Steele" wrote: > >> > > > >> > >> Try using something other than fOSUserName as the name of the text > >> > >> box. > >> > >> The > >> > >> ambiguity is probably confusing Access. > >> > >> > >> > >> -- > >> > >> Doug Steele, Microsoft Access MVP > >> > >> http://I.Am/DougSteele > >> > >> (no private e-mails, please) > >> > >> > >> > >> > >> > >> "Peter" <Pe***@discussions.microsoft.com> wrote in message > >> > >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... > >> > >> > Ok Tony...i am using this > >> > >> > > >> > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > >> > On Error GoTo BeforeUpdate_Err > >> > >> > > >> > >> > ' Set bound controls to system date and time and current user > >> > >> > name. > >> > >> > Me.DateModified = Date > >> > >> > Me.TimeModified = Time() > >> > >> > Me.fOSUserName = fOSUserName() > >> > >> > BeforeUpdate_End: > >> > >> > Exit Sub > >> > >> > BeforeUpdate_Err: > >> > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > >> > "Error Number " & Err.Number & " Occurred" > >> > >> > Resume BeforeUpdate_End > >> > >> > End Sub > >> > >> > > >> > >> > The module to pick up the API code is in place...but the bound > >> > >> > controll > >> > >> > is > >> > >> > still not populated i use the above code on a Before Update event > >> > >> > for > >> > >> > the > >> > >> > Form..and the time and date functions....i beleive i am doing > >> > >> > something > >> > >> > very > >> > >> > wrong.. > >> > >> > > >> > >> > "Tony Toews [MVP]" wrote: > >> > >> > > >> > >> >> Peter <Pe***@discussions.microsoft.com> wrote: > >> > >> >> > >> > >> >> >And the bottom line is, this is what i need. I want the username > >> > >> >> >to > >> > >> >> >be > >> > >> >> >posted on my opening form (whiwch is always open when the > >> > >> >> >application > >> > >> >> >runs) > >> > >> >> >in order to refer to it later. > >> > >> >> > >> > >> >> That's what I was wondering. Rather than sending you way off > >> > >> >> into the > >> > >> >> complex world of Access security. > >> > >> >> > >> > >> >> And I see Douglas has replied. > >> > >> >> > >> > >> >> >I appologize for my ignorance :-) > >> > >> >> > >> > >> >> We don't mind ignorance because we like helping. So continue to > >> > >> >> ask > >> > >> >> away. > >> > >> >> > >> > >> >> Tony > >> > >> >> -- > >> > >> >> Tony Toews, Microsoft Access MVP > >> > >> >> Tony's Main MS Access pages - > >> > >> >> http://www.granite.ab.ca/accsmstr.htm > >> > >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > >> > >> >> Granite Fleet Manager http://www.granitefleet.com/ > >> > >> >> > >> > >> > >> > >> > >> > >> > >> > > >> > > >> > > > > =?Utf-8?B?UGV0ZXI=?= <Pe***@discussions.microsoft.com> wrote in
news:FA86787B-79C9-43D8-8084-3869312EACE8@microsoft.com: There is absolutely no reason why this shouldn't work:> nbound textbox with controll source =fOSUserName() works just > fine..perhaps i should just set an invisible textbox with > =fOSUserName() and refer to that the following way: > > Private Sub Form_BeforeUpdate(Cancel As Integer) > On Error GoTo BeforeUpdate_Err > > ' Set bound controls to system date and time and current user > name. Me.DateModified = Date > Me.TimeModified = Time() > Me.Username = Forms!Spider_reports.UserName Me.Username = fOSUserName() If the function works in a control, then it should work there. Hi Douglas..just for your information i solved this issue the following
way...and also included the Now()..only one controll..and also the Datediff function..thanks for your patiance..the database is up and running well..you are a good teacher. Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err ' Set bound controls to system date and time and current user name. Me.DateModified = Now() Me.ModifiedBy = Forms![Username Form].[Operator] BeforeUpdate_End: Exit Sub BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ "Error Number " & Err.Number & " Occurred" Resume BeforeUpdate_End End Sub Show quoteHide quote "Douglas J. Steele" wrote: > DateDiff works just as well with Date/Time as with Time only. > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "Peter" <Pe***@discussions.microsoft.com> wrote in message > news:1F921D75-7B00-4730-886B-675A50E1D343@microsoft.com... > > ..and the reson for the seperate Time Date fieled is this idea that i want > > to > > caclulate the elapsed tome between time created and time modified in the > > future..just an experiment... > > > > "Peter" wrote: > > > >> When i replace my code with yours i receive two small popups after > >> exiting > >> the record..i did some edits > >> > >> 1. Before: Operator (29/05/2009 17:51:48) fOSUername = > >> 2. After: Operator (29/05/2009 17:54:16) > >> > >> "Douglas J. Steele" wrote: > >> > >> > So you're saying that the DateModified and TimeModified fields are > >> > being > >> > updated (why are you storing them in separate fields, btw? You should > >> > have a > >> > single field and populate it using the Now function), but that Operator > >> > isn't? That makes no sense. > >> > > >> > For debugging purposes, try the following: > >> > > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > On Error GoTo BeforeUpdate_Err > >> > > >> > MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ > >> > "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ > >> > "fOSUserName = " & fOSUserName() > >> > > >> > ' Set bound controls to system date and time and current user name. > >> > Me.DateModified = Date > >> > Me.TimeModified = Time() > >> > Me.Operator = fOSUserName() > >> > > >> > MsgBox "After: Operator " & Me.Operator & vbCrLf & _ > >> > "(" & Me.DateModified & " " & Me.TimeModified & ")" > >> > > >> > BeforeUpdate_End: > >> > Exit Sub > >> > > >> > BeforeUpdate_Err: > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > "Error Number " & Err.Number & " Occurred" > >> > Resume BeforeUpdate_End > >> > > >> > End Sub > >> > > >> > > >> > > >> > -- > >> > Doug Steele, Microsoft Access MVP > >> > http://I.Am/DougSteele > >> > (no private e-mails, please) > >> > > >> > > >> > "Peter" <Pe***@discussions.microsoft.com> wrote in message > >> > news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... > >> > > Hoping you are a person of great patiance...-:).. > >> > > > >> > > Nope..if i use the below code..it does not update my bounded Operator > >> > > text > >> > > field with the current user when i edit this specific record... > >> > > > >> > > If i set the control source to = fOSUserName() it populates this text > >> > > field...but regardless if the record is editet or not..just by > >> > > opening > >> > > it... > >> > > > >> > > I need to know whois the last person that edited the record...the > >> > > time and > >> > > date functions well..displays the current date/time the record was > >> > > edited...after that i exit the record...thats ok > >> > > > >> > > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > > On Error GoTo BeforeUpdate_Err > >> > > > >> > > ' Set bound controls to system date and time and current user > >> > > name. > >> > > Me.DateModified = Date > >> > > Me.TimeModified = Time() > >> > > Me.Operator = fOSUserName() > >> > > BeforeUpdate_End: > >> > > Exit Sub > >> > > BeforeUpdate_Err: > >> > > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > > "Error Number " & Err.Number & " Occurred" > >> > > Resume BeforeUpdat > >> > > > >> > > "Douglas J. Steele" wrote: > >> > > > >> > >> Try using something other than fOSUserName as the name of the text > >> > >> box. > >> > >> The > >> > >> ambiguity is probably confusing Access. > >> > >> > >> > >> -- > >> > >> Doug Steele, Microsoft Access MVP > >> > >> http://I.Am/DougSteele > >> > >> (no private e-mails, please) > >> > >> > >> > >> > >> > >> "Peter" <Pe***@discussions.microsoft.com> wrote in message > >> > >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... > >> > >> > Ok Tony...i am using this > >> > >> > > >> > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > >> > On Error GoTo BeforeUpdate_Err > >> > >> > > >> > >> > ' Set bound controls to system date and time and current user > >> > >> > name. > >> > >> > Me.DateModified = Date > >> > >> > Me.TimeModified = Time() > >> > >> > Me.fOSUserName = fOSUserName() > >> > >> > BeforeUpdate_End: > >> > >> > Exit Sub > >> > >> > BeforeUpdate_Err: > >> > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > >> > "Error Number " & Err.Number & " Occurred" > >> > >> > Resume BeforeUpdate_End > >> > >> > End Sub > >> > >> > > >> > >> > The module to pick up the API code is in place...but the bound > >> > >> > controll > >> > >> > is > >> > >> > still not populated i use the above code on a Before Update event > >> > >> > for > >> > >> > the > >> > >> > Form..and the time and date functions....i beleive i am doing > >> > >> > something > >> > >> > very > >> > >> > wrong.. > >> > >> > > >> > >> > "Tony Toews [MVP]" wrote: > >> > >> > > >> > >> >> Peter <Pe***@discussions.microsoft.com> wrote: > >> > >> >> > >> > >> >> >And the bottom line is, this is what i need. I want the username > >> > >> >> >to > >> > >> >> >be > >> > >> >> >posted on my opening form (whiwch is always open when the > >> > >> >> >application > >> > >> >> >runs) > >> > >> >> >in order to refer to it later. > >> > >> >> > >> > >> >> That's what I was wondering. Rather than sending you way off > >> > >> >> into the > >> > >> >> complex world of Access security. > >> > >> >> > >> > >> >> And I see Douglas has replied. > >> > >> >> > >> > >> >> >I appologize for my ignorance :-) > >> > >> >> > >> > >> >> We don't mind ignorance because we like helping. So continue to > >> > >> >> ask > >> > >> >> away. > >> > >> >> > >> > >> >> Tony > >> > >> >> -- > >> > >> >> Tony Toews, Microsoft Access MVP > >> > >> >> Tony's Main MS Access pages - > >> > >> >> http://www.granite.ab.ca/accsmstr.htm > >> > >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > >> > >> >> Granite Fleet Manager http://www.granitefleet.com/ > >> > >> >> > >> > >> > >> > >> > >> > >> > >> > > >> > > >> > > > > =?Utf-8?B?UGV0ZXI=?= <Pe***@discussions.microsoft.com> wrote in
news:6ECEBC05-95BC-41EC-81DA-EEEBC54A2057@microsoft.com: Your function is not working.> When i replace my code with yours i receive two small popups after > exiting the record..i did some edits > > 1. Before: Operator (29/05/2009 17:51:48) fOSUername = > 2. After: Operator (29/05/2009 17:54:16) I have not changed the name of the Module other then the default,
Module1...the function part of the module was automatically named fOSUsername...and if i use the controll source in a unbound textfield = fOSUername ()..it does return the correct value...is there any other way to bypass this problem...the update event functions well for date and time...so i know when the record was last edited..but not by whome.. Show quoteHide quote "David W. Fenton" wrote: > =?Utf-8?B?UGV0ZXI=?= <Pe***@discussions.microsoft.com> wrote in > news:6ECEBC05-95BC-41EC-81DA-EEEBC54A2057@microsoft.com: > > > When i replace my code with yours i receive two small popups after > > exiting the record..i did some edits > > > > 1. Before: Operator (29/05/2009 17:51:48) fOSUername = > > 2. After: Operator (29/05/2009 17:54:16) > > Your function is not working. > > -- > David W. Fenton http://www.dfenton.com/ > usenet at dfenton dot com http://www.dfenton.com/DFA/ > =?Utf-8?B?UGV0ZXI=?= <Pe***@discussions.microsoft.com> wrote in
news:EAC2A363-A642-40CC-835D-C0289C2F7976@microsoft.com: Well, for one, in what you posted:> I have not changed the name of the Module other then the default, > Module1...the function part of the module was automatically named > fOSUsername...and if i use the controll source in a unbound > textfield = fOSUername ()..it does return the correct value...is > there any other way to bypass this problem...the update event > functions well for date and time...so i know when the record was > last edited..but not by whome.. >> > 1. Before: Operator (29/05/2009 17:51:48) fOSUername = you misspelled the name of your function. I don't know where you>> > 2. After: Operator (29/05/2009 17:54:16) copied that from, but it ought to throw an error in code, unless you don't have Option Explicit in the module where you're calling it. For what it's worth, I use a wrapper function around the function that makes API call to get the user logon because I think it's senseless to ask Windows the user logon every time you need to record it -- it certainly can't change within a single Access session. So I use the function posted after my signature. For the function you're using, you'd replace "fGetUserName" with your function name, "fOSUername". What that code does is it calls it once and stores it in the Static variable. As long as the Static variable remains live, it will return the variable and not bother to ask the OS again. -- David W. Fenton http://www.dfenton.com/ usenet at dfenton dot com http://www.dfenton.com/DFA/ Public Function UserLogon() As String Static strUserLogon As String If Len(strUserLogon) = 0 Then strUserLogon = fGetUserName() End If UserLogon = strUserLogon End Function Like David says, there's a problem with your fOSUserName function. Are you
sure that it still works if you set the ControlSource of a text box to =fOSUserName? -- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:6ECEBC05-95BC-41EC-81DA-EEEBC54A2057@microsoft.com... > When i replace my code with yours i receive two small popups after exiting > the record..i did some edits > > 1. Before: Operator (29/05/2009 17:51:48) fOSUername = > 2. After: Operator (29/05/2009 17:54:16) > > "Douglas J. Steele" wrote: > >> So you're saying that the DateModified and TimeModified fields are being >> updated (why are you storing them in separate fields, btw? You should >> have a >> single field and populate it using the Now function), but that Operator >> isn't? That makes no sense. >> >> For debugging purposes, try the following: >> >> Private Sub Form_BeforeUpdate(Cancel As Integer) >> On Error GoTo BeforeUpdate_Err >> >> MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ >> "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ >> "fOSUserName = " & fOSUserName() >> >> ' Set bound controls to system date and time and current user name. >> Me.DateModified = Date >> Me.TimeModified = Time() >> Me.Operator = fOSUserName() >> >> MsgBox "After: Operator " & Me.Operator & vbCrLf & _ >> "(" & Me.DateModified & " " & Me.TimeModified & ")" >> >> BeforeUpdate_End: >> Exit Sub >> >> BeforeUpdate_Err: >> MsgBox Err.Description, vbCritical & vbOKOnly, _ >> "Error Number " & Err.Number & " Occurred" >> Resume BeforeUpdate_End >> >> End Sub >> >> >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele >> (no private e-mails, please) >> >> >> "Peter" <Pe***@discussions.microsoft.com> wrote in message >> news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... >> > Hoping you are a person of great patiance...-:).. >> > >> > Nope..if i use the below code..it does not update my bounded Operator >> > text >> > field with the current user when i edit this specific record... >> > >> > If i set the control source to = fOSUserName() it populates this text >> > field...but regardless if the record is editet or not..just by opening >> > it... >> > >> > I need to know whois the last person that edited the record...the time >> > and >> > date functions well..displays the current date/time the record was >> > edited...after that i exit the record...thats ok >> > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) >> > On Error GoTo BeforeUpdate_Err >> > >> > ' Set bound controls to system date and time and current user name. >> > Me.DateModified = Date >> > Me.TimeModified = Time() >> > Me.Operator = fOSUserName() >> > BeforeUpdate_End: >> > Exit Sub >> > BeforeUpdate_Err: >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> > "Error Number " & Err.Number & " Occurred" >> > Resume BeforeUpdat >> > >> > "Douglas J. Steele" wrote: >> > >> >> Try using something other than fOSUserName as the name of the text >> >> box. >> >> The >> >> ambiguity is probably confusing Access. >> >> >> >> -- >> >> Doug Steele, Microsoft Access MVP >> >> http://I.Am/DougSteele >> >> (no private e-mails, please) >> >> >> >> >> >> "Peter" <Pe***@discussions.microsoft.com> wrote in message >> >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... >> >> > Ok Tony...i am using this >> >> > >> >> > Private Sub Form_BeforeUpdate(Cancel As Integer) >> >> > On Error GoTo BeforeUpdate_Err >> >> > >> >> > ' Set bound controls to system date and time and current user >> >> > name. >> >> > Me.DateModified = Date >> >> > Me.TimeModified = Time() >> >> > Me.fOSUserName = fOSUserName() >> >> > BeforeUpdate_End: >> >> > Exit Sub >> >> > BeforeUpdate_Err: >> >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> >> > "Error Number " & Err.Number & " Occurred" >> >> > Resume BeforeUpdate_End >> >> > End Sub >> >> > >> >> > The module to pick up the API code is in place...but the bound >> >> > controll >> >> > is >> >> > still not populated i use the above code on a Before Update event >> >> > for >> >> > the >> >> > Form..and the time and date functions....i beleive i am doing >> >> > something >> >> > very >> >> > wrong.. >> >> > >> >> > "Tony Toews [MVP]" wrote: >> >> > >> >> >> Peter <Pe***@discussions.microsoft.com> wrote: >> >> >> >> >> >> >And the bottom line is, this is what i need. I want the username >> >> >> >to >> >> >> >be >> >> >> >posted on my opening form (whiwch is always open when the >> >> >> >application >> >> >> >runs) >> >> >> >in order to refer to it later. >> >> >> >> >> >> That's what I was wondering. Rather than sending you way off into >> >> >> the >> >> >> complex world of Access security. >> >> >> >> >> >> And I see Douglas has replied. >> >> >> >> >> >> >I appologize for my ignorance :-) >> >> >> >> >> >> We don't mind ignorance because we like helping. So continue to >> >> >> ask >> >> >> away. >> >> >> >> >> >> Tony >> >> >> -- >> >> >> Tony Toews, Microsoft Access MVP >> >> >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm >> >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ >> >> >> Granite Fleet Manager http://www.granitefleet.com/ >> >> >> >> >> >> >> >> >> >> >> >> Hmm..does access need to modify the advapi32.dll...i am not the administrator
on my system...just thinking loud Show quoteHide quote "Douglas J. Steele" wrote: > So you're saying that the DateModified and TimeModified fields are being > updated (why are you storing them in separate fields, btw? You should have a > single field and populate it using the Now function), but that Operator > isn't? That makes no sense. > > For debugging purposes, try the following: > > Private Sub Form_BeforeUpdate(Cancel As Integer) > On Error GoTo BeforeUpdate_Err > > MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ > "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ > "fOSUserName = " & fOSUserName() > > ' Set bound controls to system date and time and current user name. > Me.DateModified = Date > Me.TimeModified = Time() > Me.Operator = fOSUserName() > > MsgBox "After: Operator " & Me.Operator & vbCrLf & _ > "(" & Me.DateModified & " " & Me.TimeModified & ")" > > BeforeUpdate_End: > Exit Sub > > BeforeUpdate_Err: > MsgBox Err.Description, vbCritical & vbOKOnly, _ > "Error Number " & Err.Number & " Occurred" > Resume BeforeUpdate_End > > End Sub > > > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele > (no private e-mails, please) > > > "Peter" <Pe***@discussions.microsoft.com> wrote in message > news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... > > Hoping you are a person of great patiance...-:).. > > > > Nope..if i use the below code..it does not update my bounded Operator text > > field with the current user when i edit this specific record... > > > > If i set the control source to = fOSUserName() it populates this text > > field...but regardless if the record is editet or not..just by opening > > it... > > > > I need to know whois the last person that edited the record...the time and > > date functions well..displays the current date/time the record was > > edited...after that i exit the record...thats ok > > > > Private Sub Form_BeforeUpdate(Cancel As Integer) > > On Error GoTo BeforeUpdate_Err > > > > ' Set bound controls to system date and time and current user name. > > Me.DateModified = Date > > Me.TimeModified = Time() > > Me.Operator = fOSUserName() > > BeforeUpdate_End: > > Exit Sub > > BeforeUpdate_Err: > > MsgBox Err.Description, vbCritical & vbOKOnly, _ > > "Error Number " & Err.Number & " Occurred" > > Resume BeforeUpdat > > > > "Douglas J. Steele" wrote: > > > >> Try using something other than fOSUserName as the name of the text box. > >> The > >> ambiguity is probably confusing Access. > >> > >> -- > >> Doug Steele, Microsoft Access MVP > >> http://I.Am/DougSteele > >> (no private e-mails, please) > >> > >> > >> "Peter" <Pe***@discussions.microsoft.com> wrote in message > >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... > >> > Ok Tony...i am using this > >> > > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) > >> > On Error GoTo BeforeUpdate_Err > >> > > >> > ' Set bound controls to system date and time and current user name. > >> > Me.DateModified = Date > >> > Me.TimeModified = Time() > >> > Me.fOSUserName = fOSUserName() > >> > BeforeUpdate_End: > >> > Exit Sub > >> > BeforeUpdate_Err: > >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ > >> > "Error Number " & Err.Number & " Occurred" > >> > Resume BeforeUpdate_End > >> > End Sub > >> > > >> > The module to pick up the API code is in place...but the bound controll > >> > is > >> > still not populated i use the above code on a Before Update event for > >> > the > >> > Form..and the time and date functions....i beleive i am doing something > >> > very > >> > wrong.. > >> > > >> > "Tony Toews [MVP]" wrote: > >> > > >> >> Peter <Pe***@discussions.microsoft.com> wrote: > >> >> > >> >> >And the bottom line is, this is what i need. I want the username to > >> >> >be > >> >> >posted on my opening form (whiwch is always open when the application > >> >> >runs) > >> >> >in order to refer to it later. > >> >> > >> >> That's what I was wondering. Rather than sending you way off into the > >> >> complex world of Access security. > >> >> > >> >> And I see Douglas has replied. > >> >> > >> >> >I appologize for my ignorance :-) > >> >> > >> >> We don't mind ignorance because we like helping. So continue to ask > >> >> away. > >> >> > >> >> Tony > >> >> -- > >> >> Tony Toews, Microsoft Access MVP > >> >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm > >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ > >> >> Granite Fleet Manager http://www.granitefleet.com/ > >> >> > >> > >> > >> > > > Shouldn't need to be administrator, and I'm unaware of any interactions
between Access and advapi32.dll -- Show quoteHide quoteDoug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Peter" <Pe***@discussions.microsoft.com> wrote in message news:78CC68FB-C296-430D-A8E0-1F9D365ABB4D@microsoft.com... > Hmm..does access need to modify the advapi32.dll...i am not the > administrator > on my system...just thinking loud > > "Douglas J. Steele" wrote: > >> So you're saying that the DateModified and TimeModified fields are being >> updated (why are you storing them in separate fields, btw? You should >> have a >> single field and populate it using the Now function), but that Operator >> isn't? That makes no sense. >> >> For debugging purposes, try the following: >> >> Private Sub Form_BeforeUpdate(Cancel As Integer) >> On Error GoTo BeforeUpdate_Err >> >> MsgBox "Before: Operator " & Me.Operator & vbCrLf & _ >> "(" & Me.DateModified & " " & Me.TimeModified & ")" & vbCrLf & _ >> "fOSUserName = " & fOSUserName() >> >> ' Set bound controls to system date and time and current user name. >> Me.DateModified = Date >> Me.TimeModified = Time() >> Me.Operator = fOSUserName() >> >> MsgBox "After: Operator " & Me.Operator & vbCrLf & _ >> "(" & Me.DateModified & " " & Me.TimeModified & ")" >> >> BeforeUpdate_End: >> Exit Sub >> >> BeforeUpdate_Err: >> MsgBox Err.Description, vbCritical & vbOKOnly, _ >> "Error Number " & Err.Number & " Occurred" >> Resume BeforeUpdate_End >> >> End Sub >> >> >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele >> (no private e-mails, please) >> >> >> "Peter" <Pe***@discussions.microsoft.com> wrote in message >> news:37539BC6-CD75-4A79-8B79-DA437515157A@microsoft.com... >> > Hoping you are a person of great patiance...-:).. >> > >> > Nope..if i use the below code..it does not update my bounded Operator >> > text >> > field with the current user when i edit this specific record... >> > >> > If i set the control source to = fOSUserName() it populates this text >> > field...but regardless if the record is editet or not..just by opening >> > it... >> > >> > I need to know whois the last person that edited the record...the time >> > and >> > date functions well..displays the current date/time the record was >> > edited...after that i exit the record...thats ok >> > >> > Private Sub Form_BeforeUpdate(Cancel As Integer) >> > On Error GoTo BeforeUpdate_Err >> > >> > ' Set bound controls to system date and time and current user name. >> > Me.DateModified = Date >> > Me.TimeModified = Time() >> > Me.Operator = fOSUserName() >> > BeforeUpdate_End: >> > Exit Sub >> > BeforeUpdate_Err: >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> > "Error Number " & Err.Number & " Occurred" >> > Resume BeforeUpdat >> > >> > "Douglas J. Steele" wrote: >> > >> >> Try using something other than fOSUserName as the name of the text >> >> box. >> >> The >> >> ambiguity is probably confusing Access. >> >> >> >> -- >> >> Doug Steele, Microsoft Access MVP >> >> http://I.Am/DougSteele >> >> (no private e-mails, please) >> >> >> >> >> >> "Peter" <Pe***@discussions.microsoft.com> wrote in message >> >> news:97AF0568-9C8B-4BCA-AF0E-16DB54BA6E84@microsoft.com... >> >> > Ok Tony...i am using this >> >> > >> >> > Private Sub Form_BeforeUpdate(Cancel As Integer) >> >> > On Error GoTo BeforeUpdate_Err >> >> > >> >> > ' Set bound controls to system date and time and current user >> >> > name. >> >> > Me.DateModified = Date >> >> > Me.TimeModified = Time() >> >> > Me.fOSUserName = fOSUserName() >> >> > BeforeUpdate_End: >> >> > Exit Sub >> >> > BeforeUpdate_Err: >> >> > MsgBox Err.Description, vbCritical & vbOKOnly, _ >> >> > "Error Number " & Err.Number & " Occurred" >> >> > Resume BeforeUpdate_End >> >> > End Sub >> >> > >> >> > The module to pick up the API code is in place...but the bound >> >> > controll >> >> > is >> >> > still not populated i use the above code on a Before Update event >> >> > for >> >> > the >> >> > Form..and the time and date functions....i beleive i am doing >> >> > something >> >> > very >> >> > wrong.. >> >> > >> >> > "Tony Toews [MVP]" wrote: >> >> > >> >> >> Peter <Pe***@discussions.microsoft.com> wrote: >> >> >> >> >> >> >And the bottom line is, this is what i need. I want the username >> >> >> >to >> >> >> >be >> >> >> >posted on my opening form (whiwch is always open when the >> >> >> >application >> >> >> >runs) >> >> >> >in order to refer to it later. >> >> >> >> >> >> That's what I was wondering. Rather than sending you way off into >> >> >> the >> >> >> complex world of Access security. >> >> >> >> >> >> And I see Douglas has replied. >> >> >> >> >> >> >I appologize for my ignorance :-) >> >> >> >> >> >> We don't mind ignorance because we like helping. So continue to >> >> >> ask >> >> >> away. >> >> >> >> >> >> Tony >> >> >> -- >> >> >> Tony Toews, Microsoft Access MVP >> >> >> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm >> >> >> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ >> >> >> Granite Fleet Manager http://www.granitefleet.com/ >> >> >> >> >> >> >> >> >> >> >> >>
Other interesting topics
Unable to compact/repair because I have it opened
Access Networking & Security Issue. Problem deleting records - Access XP and our intranet Project is Unviewable Objects Security Permission Access 2007 -> /pwd -> how to work around? Read-Only Database! Need Help With Security After migrating .mdb to v.2007 & rename mdw file, v.2007 lets me i Upgrade a password protected database |
|||||||||||||||||||||||