I am using the fOSUserName functionality in my DB. I would like to use it to
dynamically preface comments a user types into a text box.
Scenario...user opens a ticket form, starts typing a comment in the text
box, and Access automatically inserts their username in front of their
comments (in bold typeface if possible) followed by a couple spaces, or a
space dash space.
Any ideas? Thanks!
|
|
0
|
|
|
|
Reply
|
Utf
|
1/24/2008 5:23:04 PM |
|
Paul,
Use the AfterUpdate event of your text control (ex. control name =
[Comments])
Me.Comments = CurrentUser & " - " & [Comments]
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your life."
"Paul" <Paul@discussions.microsoft.com> wrote in message
news:13E70263-D749-4C69-92D9-040F98E3938D@microsoft.com...
>I am using the fOSUserName functionality in my DB. I would like to use it
>to
> dynamically preface comments a user types into a text box.
>
> Scenario...user opens a ticket form, starts typing a comment in the text
> box, and Access automatically inserts their username in front of their
> comments (in bold typeface if possible) followed by a couple spaces, or a
> space dash space.
>
> Any ideas? Thanks!
|
|
0
|
|
|
|
Reply
|
Al
|
1/24/2008 5:37:10 PM
|
|
Paul,
I would recommend against this, since it violates the 1st Normal form (more
than one piece of information in a field). Instead, I recommend you add a
UserID field to the table, and update it before a record is written.
But it sounds like you want to use this textbox as a running summation of
comments made by multiple people about a particular ticket. If that is so,
then what you really need is a separate table that contains the fields for a
foreign key (TicketID), UserID, Comment, and dtEntered (date/time field).
Then, you can create a subform that displays all of these fields. You can
set the txt_UserID controls default value to "=fOSUserName()" so that it
automatically gets entered when you create a new record.
HTH
Dale
rather than using a single textbox, you create a
--
Don''t forget to rate the post if it was helpful!
email address is invalid
Please reply to newsgroup only.
"Paul" wrote:
> I am using the fOSUserName functionality in my DB. I would like to use it to
> dynamically preface comments a user types into a text box.
>
> Scenario...user opens a ticket form, starts typing a comment in the text
> box, and Access automatically inserts their username in front of their
> comments (in bold typeface if possible) followed by a couple spaces, or a
> space dash space.
>
> Any ideas? Thanks!
|
|
0
|
|
|
|
Reply
|
Utf
|
1/24/2008 6:44:04 PM
|
|
These are both good suggestions, but might I add mine. If you don't have any
user setting setup or login, etc.
On the After Update of any field or record:
me.[textbox, field, note, whatever you decide to update] = environ("USERNAME")
....this will update the field with the users environ settings, basically the
same way that it would update a comment in a note in excel.
"Paul" wrote:
> I am using the fOSUserName functionality in my DB. I would like to use it to
> dynamically preface comments a user types into a text box.
>
> Scenario...user opens a ticket form, starts typing a comment in the text
> box, and Access automatically inserts their username in front of their
> comments (in bold typeface if possible) followed by a couple spaces, or a
> space dash space.
>
> Any ideas? Thanks!
|
|
0
|
|
|
|
Reply
|
Utf
|
1/24/2008 6:51:03 PM
|
|
I always cringe when I see someone recommending using the Environ function
to get user name. It's trivial to reset the value of the environment
variable for the duration of the Access session.
Paul's mentioned fOSUserName, which is presumably the code from
http://www.mvps.org/access/api/api0008.htm at "The Access Web" that
demonstrates the GetUserName API that's far, far more reliable than Environ.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"meyerryang" <meyerryang@discussions.microsoft.com> wrote in message
news:F24A5941-113A-4214-AB26-FD041DFE4133@microsoft.com...
> These are both good suggestions, but might I add mine. If you don't have
> any
> user setting setup or login, etc.
>
> On the After Update of any field or record:
>
> me.[textbox, field, note, whatever you decide to update] =
> environ("USERNAME")
>
> ...this will update the field with the users environ settings, basically
> the
> same way that it would update a comment in a note in excel.
>
> "Paul" wrote:
>
>> I am using the fOSUserName functionality in my DB. I would like to use it
>> to
>> dynamically preface comments a user types into a text box.
>>
>> Scenario...user opens a ticket form, starts typing a comment in the text
>> box, and Access automatically inserts their username in front of their
>> comments (in bold typeface if possible) followed by a couple spaces, or a
>> space dash space.
>>
>> Any ideas? Thanks!
|
|
0
|
|
|
|
Reply
|
Douglas
|
1/24/2008 7:37:09 PM
|
|
Since I'm just looking to add a simple identifier of the person who added the
specific update, I decided to use the option Al provided in the After Update,
but I substituted 'CurrentUser' with fOSUserName():
Me.Comment = fOSUserName() & " - " & [Comment]
This works great for what I'm wanting to do.
Two more items...
1. I would really like to be able to bold the username and not the rest of
the text in the text box but I don't believe this can be done with Access '03
in it's maiden form.
2. I wouldn't mind being able to tie the fOSUserName value back to my
'Contacts' table which has a field for the network logon id...and then return
back the 'Name' field from that table (Contacts) and show it instead of their
network logon id, aka the fOSUserName.
Suggestions?
"Paul" wrote:
> I am using the fOSUserName functionality in my DB. I would like to use it to
> dynamically preface comments a user types into a text box.
>
> Scenario...user opens a ticket form, starts typing a comment in the text
> box, and Access automatically inserts their username in front of their
> comments (in bold typeface if possible) followed by a couple spaces, or a
> space dash space.
>
> Any ideas? Thanks!
|
|
0
|
|
|
|
Reply
|
Utf
|
1/24/2008 8:02:01 PM
|
|
"Paul" <Paul@discussions.microsoft.com> wrote in message
news:B0B0FC37-FA0F-4576-878D-BF21D14DFE92@microsoft.com...
> Since I'm just looking to add a simple identifier of the person who added
> the
> specific update, I decided to use the option Al provided in the After
> Update,
> but I substituted 'CurrentUser' with fOSUserName():
>
> Me.Comment = fOSUserName() & " - " & [Comment]
>
> This works great for what I'm wanting to do.
>
> Two more items...
>
> 1. I would really like to be able to bold the username and not the rest of
> the text in the text box but I don't believe this can be done with Access
> '03
> in it's maiden form.
You're correct that there's no way to bold only part of the text in
"vanilla" Access 2003: you'd have to use an RTF control, and I think you'd
find that far more effort than it's worth.
> 2. I wouldn't mind being able to tie the fOSUserName value back to my
> 'Contacts' table which has a field for the network logon id...and then
> return
> back the 'Name' field from that table (Contacts) and show it instead of
> their
> network logon id, aka the fOSUserName.
Me.Comment = DLookup("[Name]", "[Contacts]", "LogonId ='" & fOSUserName() &
"'") & " - " & [Comment]
(or whatever the field name is rather than LogonId). Note that's ' " before
the ampersand, and " ' " after it.
Note that Name isn't actually a good choice for a field name: it's a
reserved word, and you shouldn't use reserved words for your own purposes.
For a good discussion of what names to avoid, see what Allen Browne has at
http://www.allenbrowne.com/AppIssueBadWord.html
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
|
|
0
|
|
|
|
Reply
|
Douglas
|
1/24/2008 8:12:42 PM
|
|
Thanks, that worked very well...one last question...how would your line of
code differ if I wanted to include 2 fields so I had the first and last name?
I tried playing around with it, but was unable to make it work. I take that
back, I could get it to pull both back, but I couldn't get it to put a space
between the First and Last name so I got 'FirstLast -' instead of 'First Last
- '.
"Douglas J. Steele" wrote:
> "Paul" <Paul@discussions.microsoft.com> wrote in message
> news:B0B0FC37-FA0F-4576-878D-BF21D14DFE92@microsoft.com...
> > Since I'm just looking to add a simple identifier of the person who added
> > the
> > specific update, I decided to use the option Al provided in the After
> > Update,
> > but I substituted 'CurrentUser' with fOSUserName():
> >
> > Me.Comment = fOSUserName() & " - " & [Comment]
> >
> > This works great for what I'm wanting to do.
> >
> > Two more items...
> >
> > 1. I would really like to be able to bold the username and not the rest of
> > the text in the text box but I don't believe this can be done with Access
> > '03
> > in it's maiden form.
>
> You're correct that there's no way to bold only part of the text in
> "vanilla" Access 2003: you'd have to use an RTF control, and I think you'd
> find that far more effort than it's worth.
>
> > 2. I wouldn't mind being able to tie the fOSUserName value back to my
> > 'Contacts' table which has a field for the network logon id...and then
> > return
> > back the 'Name' field from that table (Contacts) and show it instead of
> > their
> > network logon id, aka the fOSUserName.
>
> Me.Comment = DLookup("[Name]", "[Contacts]", "LogonId ='" & fOSUserName() &
> "'") & " - " & [Comment]
>
> (or whatever the field name is rather than LogonId). Note that's ' " before
> the ampersand, and " ' " after it.
>
> Note that Name isn't actually a good choice for a field name: it's a
> reserved word, and you shouldn't use reserved words for your own purposes.
> For a good discussion of what names to avoid, see what Allen Browne has at
> http://www.allenbrowne.com/AppIssueBadWord.html
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
1/24/2008 9:36:47 PM
|
|
You can actually cheat, and have DLookup return two fields at once:
Me.Comment = DLookup("[FirstName] & ' ' & [LastName]", "[Contacts]",
"LogonId ='" & fOSUserName() & "'") & " - " & [Comment]
Note that's a pair of single quotes, separated by a space, between the
names.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Paul" <Paul@discussions.microsoft.com> wrote in message
news:D450F314-108E-41D1-B838-C8763DF4BC47@microsoft.com...
> Thanks, that worked very well...one last question...how would your line of
> code differ if I wanted to include 2 fields so I had the first and last
> name?
>
> I tried playing around with it, but was unable to make it work. I take
> that
> back, I could get it to pull both back, but I couldn't get it to put a
> space
> between the First and Last name so I got 'FirstLast -' instead of 'First
> Last
> - '.
>
> "Douglas J. Steele" wrote:
>
>> "Paul" <Paul@discussions.microsoft.com> wrote in message
>> news:B0B0FC37-FA0F-4576-878D-BF21D14DFE92@microsoft.com...
>> > Since I'm just looking to add a simple identifier of the person who
>> > added
>> > the
>> > specific update, I decided to use the option Al provided in the After
>> > Update,
>> > but I substituted 'CurrentUser' with fOSUserName():
>> >
>> > Me.Comment = fOSUserName() & " - " & [Comment]
>> >
>> > This works great for what I'm wanting to do.
>> >
>> > Two more items...
>> >
>> > 1. I would really like to be able to bold the username and not the rest
>> > of
>> > the text in the text box but I don't believe this can be done with
>> > Access
>> > '03
>> > in it's maiden form.
>>
>> You're correct that there's no way to bold only part of the text in
>> "vanilla" Access 2003: you'd have to use an RTF control, and I think
>> you'd
>> find that far more effort than it's worth.
>>
>> > 2. I wouldn't mind being able to tie the fOSUserName value back to my
>> > 'Contacts' table which has a field for the network logon id...and then
>> > return
>> > back the 'Name' field from that table (Contacts) and show it instead of
>> > their
>> > network logon id, aka the fOSUserName.
>>
>> Me.Comment = DLookup("[Name]", "[Contacts]", "LogonId ='" & fOSUserName()
>> &
>> "'") & " - " & [Comment]
>>
>> (or whatever the field name is rather than LogonId). Note that's ' "
>> before
>> the ampersand, and " ' " after it.
>>
>> Note that Name isn't actually a good choice for a field name: it's a
>> reserved word, and you shouldn't use reserved words for your own
>> purposes.
>> For a good discussion of what names to avoid, see what Allen Browne has
>> at
>> http://www.allenbrowne.com/AppIssueBadWord.html
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>>
>>
|
|
0
|
|
|
|
Reply
|
Douglas
|
1/24/2008 10:16:02 PM
|
|
Works like a charm, thanks Doug! I was making the mistake of using double
quotes instead of single quotes!
"Douglas J. Steele" wrote:
> You can actually cheat, and have DLookup return two fields at once:
>
> Me.Comment = DLookup("[FirstName] & ' ' & [LastName]", "[Contacts]",
> "LogonId ='" & fOSUserName() & "'") & " - " & [Comment]
>
> Note that's a pair of single quotes, separated by a space, between the
> names.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Paul" <Paul@discussions.microsoft.com> wrote in message
> news:D450F314-108E-41D1-B838-C8763DF4BC47@microsoft.com...
> > Thanks, that worked very well...one last question...how would your line of
> > code differ if I wanted to include 2 fields so I had the first and last
> > name?
> >
> > I tried playing around with it, but was unable to make it work. I take
> > that
> > back, I could get it to pull both back, but I couldn't get it to put a
> > space
> > between the First and Last name so I got 'FirstLast -' instead of 'First
> > Last
> > - '.
> >
> > "Douglas J. Steele" wrote:
> >
> >> "Paul" <Paul@discussions.microsoft.com> wrote in message
> >> news:B0B0FC37-FA0F-4576-878D-BF21D14DFE92@microsoft.com...
> >> > Since I'm just looking to add a simple identifier of the person who
> >> > added
> >> > the
> >> > specific update, I decided to use the option Al provided in the After
> >> > Update,
> >> > but I substituted 'CurrentUser' with fOSUserName():
> >> >
> >> > Me.Comment = fOSUserName() & " - " & [Comment]
> >> >
> >> > This works great for what I'm wanting to do.
> >> >
> >> > Two more items...
> >> >
> >> > 1. I would really like to be able to bold the username and not the rest
> >> > of
> >> > the text in the text box but I don't believe this can be done with
> >> > Access
> >> > '03
> >> > in it's maiden form.
> >>
> >> You're correct that there's no way to bold only part of the text in
> >> "vanilla" Access 2003: you'd have to use an RTF control, and I think
> >> you'd
> >> find that far more effort than it's worth.
> >>
> >> > 2. I wouldn't mind being able to tie the fOSUserName value back to my
> >> > 'Contacts' table which has a field for the network logon id...and then
> >> > return
> >> > back the 'Name' field from that table (Contacts) and show it instead of
> >> > their
> >> > network logon id, aka the fOSUserName.
> >>
> >> Me.Comment = DLookup("[Name]", "[Contacts]", "LogonId ='" & fOSUserName()
> >> &
> >> "'") & " - " & [Comment]
> >>
> >> (or whatever the field name is rather than LogonId). Note that's ' "
> >> before
> >> the ampersand, and " ' " after it.
> >>
> >> Note that Name isn't actually a good choice for a field name: it's a
> >> reserved word, and you shouldn't use reserved words for your own
> >> purposes.
> >> For a good discussion of what names to avoid, see what Allen Browne has
> >> at
> >> http://www.allenbrowne.com/AppIssueBadWord.html
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >>
> >>
>
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
1/25/2008 1:04:00 PM
|
|
|
9 Replies
144 Views
(page loaded in 1.037 seconds)
Similiar Articles: How do I insert a text box in Mac Word? - microsoft.public.mac ...Insert> Text Box. You'll also find the Text Box button on the Drawing Toolbar. ... How to Insert a Box Into a Word Document | eHow.com How to Insert a Box Into a Word ... Insert a PDF page into a Word document - microsoft.public.word ...Is there a decent way to insert a PDF page into a Word document, like into a text box? ...that is, other than printing it out, scanning it into a ... adding a border to a text box in word - microsoft.public.word ...-- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama ... Then open the header pane, choose Insert > Text Box, and draw a text ... How to Add Borders ... Selecting Items From Listbox and storing into table - microsoft ...... Then strName = .Value strSQL = "INSERT INTO tblUser (UserName) VALUES ... But then all my text in my list box disappeared. I know this is kind of vague ... inserting XML in word 2007 - microsoft.public.word.vba.general ...Inserting the Window username into MS Word file - microsoft.public ... inserting XML ... frame in Word 2007 - microsoft.public.word.newusers ... You could insert a text box or ... Inserting the Window username into MS Word file - microsoft.public ...When I took Word 2003 in school, I learned how to insert text into a ... QAT button to ... Inserting the Window username into MS Word file Inserting the Window username into ... insert all column(x) values in a single textbox - microsoft.public ...Your combo box holds X lines of data, each line has Y columns ... VS 2010 [RESOLVED] INSERT INTO(Column...) VALUES(NULL, Textbox.text issue Visual Basic .NET ... insert text from file - microsoft.public.word.docmanagement ...Inserting a new text box into a report - microsoft.public.access ... How to Insert Text From ... JPEG into New Message Headers (not ... Inserting Text From ... vbscript insert into access 2003 database with two different table ...... Data Source= U:\My Documents\ComputerInventory.mdb" 'Read Text File ... Else > 'cnn.Execute "INSERT INTO user_tbl (username, fullname) VALUES ('" & > strvalue ... Insert Object Problem - microsoft.public.excel.miscHi All, I inserted a PDF as an Object into Excel sheet . Now I see the PDF page in my Excel . But When I try insert a Text Box over the PDF ima... Microsoft Word Tutorial - Insert Text BoxLearning Generation - Tutorial Template ... Insert a Text box Tutorial Microsoft Word Objective: To insert a text box into a Microsoft Word document How to Insert a Text Box Into MySQL With PHP | eHow.comHow to Insert a Text Box Into MySQL With PHP. Web developers ... and email use the Get method while the text box input is transferred with the Post method. $username ... Insert a text box - InfoPath - Office.comBy default, when you insert a text box on your form template, InfoPath adds a single ... Entering data into a text box is easy. Users place their cursor inside the text box ... How to Insert a Text Box Into HTML | eHow.comForms are widely used on websites. Anyone who has signed up for a Web-based email account, purchased an item from an e-commerce site or filled out feedback has used ... SQL Select Based on Text Inserted Into a Text BoxSQL Select Based on Text Inserted Into a Text Box ... Make sure you insert you DBname, username, and password into the appropriate places in the string. 7/17/2012 11:08:55 AM
|