[AccessD] an ACCESS query

John Colby jwcolby at gmail.com
Tue Mar 12 15:42:35 CDT 2019


Normally you use an auto increment integer pk generated by the database. It
is not something that the user sees or is even aware of.

Now if you are discussing adding some Id as a foreign key, then the access
subform just inserts is as part of it's link parent/child function.

On Tue, Mar 12, 2019, 3:30 PM John W. Clark <John.Clark at niagaracounty.com>
wrote:

> If I can bug y'all with one more thing. How would you suggest I'd add this
> ID to a record each time a new one is opened or saved?
>
> If I remember correctly I'd normally do something like this OnOpen for the
> form, but here I want to do it when a new record is opened. I want the user
> to be unable to edit/delete this. For the latter I just locked it.
>
> ________________________________
> From: AccessD <accessd-bounces at databaseadvisors.com> on behalf of Ryan W <
> wrwehler at gmail.com>
> Sent: Tuesday, March 12, 2019 1:03 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] an ACCESS query
>
> No prob. :)
>
>
> On Tue, Mar 12, 2019 at 12:02 PM John W. Clark <
> John.Clark at niagaracounty.com>
> wrote:
>
> > Wow, I was overthinking that one just a bit, eh?! Thanks, I think this
> > will suffice!
> >
> > ________________________________
> > From: AccessD <accessd-bounces at databaseadvisors.com> on behalf of Ryan
> W <
> > wrwehler at gmail.com>
> > Sent: Tuesday, March 12, 2019 12:40 PM
> > To: Access Developers discussion and problem solving
> > Subject: Re: [AccessD] an ACCESS query
> >
> > What about just
> >
> > Environ("Username") ?
> >
> >
> >
> > On Tue, Mar 12, 2019 at 11:39 AM Bob Walsh <BWalsh at healthinsight.org>
> > wrote:
> >
> > > Something like this?
> > >
> > > Declare PtrSafe 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
> > >
> > > From: AccessD <accessd-bounces at databaseadvisors.com> On Behalf Of John
> > W.
> > > Clark
> > > Sent: Tuesday, March 12, 2019 9:36 AM
> > > To: Access Developers discussion and problem solving <
> > > accessd at databaseadvisors.com>
> > > Subject: Re: [AccessD] an ACCESS query
> > >
> > > [Attn: This is an external email.]
> > >
> > > I haven't been out here in quite a while, but I'm hoping someone can
> save
> > > me. I seem to have forgotten some things and I need to grab a user's
> > Active
> > > Directory login ID and put it in a record.
> > >
> > > I actually haven't programmed anything in quite a while. I've been
> > playing
> > > with VoIP phones and email lately and haven't needed to work with MS
> > Access
> > > in a very long time. I still lurk every now and then and read the
> posts,
> > > but I haven't needed to use it.
> > >
> > > I'm praying someone has some code I can use to do this quick. I was
> > trying
> > > to use a couple of things, like:
> > >
> > >
> > > Dim strUser as String
> > > strUser = ActiveDirectory.User()
> > > MsgBox "Welcome back, " & strUser
> > >
> > > but I get nothing...no errors, just nothing. I've tried variations and
> > > some other code I've found as well.
> > >
> > > Is the "ActiveDirectory" code above native or should I be invoking
> > > something to make it work?
> > >
> > >
> > > 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<mailto:AccessD at databaseadvisors.com>
> > > http://databaseadvisors.com/mailman/listinfo/accessd<
> > > http://databaseadvisors.com/mailman/listinfo/accessd>
> > > Website: http://www.databaseadvisors.com<
> http://www.databaseadvisors.com
> > >
> > >
> > > ________________________________
> > > HealthInsight is a private, nonprofit, community-based organization
> > > dedicated to improving health and health care, with offices in four
> > western
> > > states: Nevada, New Mexico, Oregon and Utah. HealthInsight also has
> > > operations in Seattle, Wash., and Glendale, Calif., supporting
> End-Stage
> > > Renal Disease Networks in the Western United States. The information
> and
> > > any materials included in this transmission may contain confidential
> > > information from HealthInsight. The information is intended for use by
> > the
> > > person named on this transmittal. If you are not the intended
> recipient,
> > be
> > > aware that any disclosure, copying, distribution, or use of the
> contents
> > of
> > > this transmission is prohibited. If you have received this message in
> > > error, please inform the sender and delete all copies.
> > > --
> > > 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
> >
> --
> 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