[AccessD] Help on entering data -- when to do it?
jack drawbridge
jackandpat.d at gmail.com
Mon Dec 23 13:26:15 CST 2019
Hi John,
I do remember you on AccessD--- Merry Christmas!
You can get the username using this code
[code]
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 = ""
End If
End Function [code]
which is located at
http://www.databasedev.co.uk/get_username_or_computername.html
On Mon, Dec 23, 2019 at 2:09 PM John W. Clark <John.Clark at niagaracounty.com>
wrote:
> Oh...almost forgot...yes, I can retrieve the ID. But right now it isn't
> being assigned to a record for some reason -- I probably didn't link it
> yet. I just need their ID.
>
> ________________________________
> From: AccessD <accessd-bounces at databaseadvisors.com> on behalf of
> rockysmolin bchacc.com <rockysmolin at bchacc.com>
> Sent: Monday, December 23, 2019 1:44 PM
> To: Access Developers discussion and problem solving <
> accessd at databaseadvisors.com>
> Subject: Re: [AccessD] Help on entering data -- when to do it?
>
> [EXTERNAL MESSAGE]
>
> This email originated from outside of the organization. Do not click links
> or open attachments unless you recognize the sender and know the content is
> safe.
> - Niagara County IT
>
> I assume you have or can retrieve the ID (I always save the user name, ID,
> access level, etc. in a global variables when they logged in?).
>
> I would use the On Add event which is triggered when a new record is
> created. On Dirty is more appropriate I think for editing when you want to
> test a record to see if the user has made any changes to the record. But I
> think either should work.
>
> HTH
>
>
> Rocky Smolin
> Beach Access Software
> 760-683-5777
> www.bchacc.com<http://www.bchacc.com>
> www.e-z-mrp.com<http://www.e-z-mrp.com>
> Skype: rocky.smolin
>
>
>
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> John W. Clark
> Sent: Monday, December 23, 2019 10:38 AM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] Help on entering data -- when to do it?
>
> Hey All! There are probably many people here who many not remember me. It
> has been a very long time since asking any questions here. This is because,
> (A) because of the list I became quite proficient, and (B) I haven't worked
> with Access in a very long time -- I've done some little stuff here and
> there, but no programming in a while. I now inherited one of my favorite
> tasks (I'm being very sarcastic here) and I am fixing the code of someone
> who is a non-programmer and wrote code that a department now wants to use.
>
> Maybe it is because I have become rusty, but I now find myself needing
> some help. I've got it mostly working, but I have one little issue at the
> moment -- I added a field to find the user ID of the person logged in, and
> I want to be able to put that in the record, so we can track who made the
> entry. I initially did this for the onOpen event of the form, but now I am
> unable to turn off filtering and scroll through all the records. I can hit
> ESC and then do this, but I don't want the user to have to do this. So I'm
> thinking I need to assign that field elsewhere -- perhaps OnDirty? That is
> what I am asking -- at what point should I be putting this in? I never used
> the even OnDirty in all the years I programmed -- don't know why; just
> never needed to -- so I'm a bit shaky on what it means exactly. Or perhaps
> there is a better way to do this?
>
>
> Notice: This electronic transmission is intended for the sole use of the
> individual or entity to which it is addressed and may contain confidential,
> privileged or otherwise legally protected information. If you are not the
> intended recipient, or if you believe you are not the intended recipient,
> you are hereby notified that any use, disclosure, copying, distribution, or
> the taking of any action in reliance on the contents of this information,
> is strictly prohibited. Niagara County is not responsible for the content
> of any external hyperlink referenced in this email or any email. IF YOU
> HAVE RECEIVED THIS TRANSMISSION IN ERROR, PLEASE NOTIFY THE SENDER
> IMMEDIATELY BY EMAIL AND DELETE THE ORIGINAL MESSAGE ALONG WITH ANY PAPER
> OR ELECTRONIC COPIES. Thank you for your cooperation.
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> Notice: This electronic transmission is intended for the sole use of the
> individual or entity to which it is addressed and may contain confidential,
> privileged or otherwise legally protected information. If you are not the
> intended recipient, or if you believe you are not the intended recipient,
> you are hereby notified that any use, disclosure, copying, distribution, or
> the taking of any action in reliance on the contents of this information,
> is strictly prohibited. Niagara County is not responsible for the content
> of any external hyperlink referenced in this email or any email. IF YOU
> HAVE RECEIVED THIS TRANSMISSION IN ERROR, PLEASE NOTIFY THE SENDER
> IMMEDIATELY BY EMAIL AND DELETE THE ORIGINAL MESSAGE ALONG WITH ANY PAPER
> OR ELECTRONIC COPIES. Thank you for your cooperation.
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list