Comments box with username?

David Bratby

Registered User.
Local time
Today, 23:02
Joined
Oct 20, 2015
Messages
19
Hi,

Its me again.

I have a form with a comments box that appends the data and displays it in another unbound text box as a history with a time stamp using =ColumnHistory([RecordSource],"Notes","[ID]=" & Nz([ID],0)).

I think this is called column history?

This is all working well.

On the same form I have a combo box with some usernames in.

Is there a way I can combine the username with the time stamp?

Thanks in advance.

Dave
 
Hi,

I am still having trouble with this. I don't know if it was because my original post was unclear of what I'm trying to do.


I have a form with a combo box with a list of user names, a comments box and a history box.

I have set the comments box to append and the history box uses

=ColumnHistory([RecordSource],"Notes","[ID]=" & Nz([ID],0)).

This displays the history of comments box with a time stamp perfectly.

What I would like to do is somehow record the the username with the comments.

Is there a way to do this? or an alternative way of doing it?

Thanks in advance,

Dave
 
You could try

=ColumnHistory([RecordSource],"Notes","[ID]=" & Nz([ID],0)) & [nameofcombobox]

where nameofcombobox would be name of the combo box with the user name, but this might give you something else like an id number. If that happen's post the name of this combo box and the SQL of the row source of it and I'll give you something else to try.
 
Hi,

Thank you for your reply.

This is putting the id number in the comments box rather than the username.

Also, it isn't storing the id number (username) along with the message. It is just displaying it at the end of the last stored comments message.

Thanks again,

Dave
 
How about posting a copy of your database --remove anything confidential?
And tell us about your application --business terms -- not just a form and combobox.

It sounds like you're trying to create or write to a log file, but that's just a guess. You may be using lookup fields which can be problematic re showing numbers vs text.
 
Last edited:
This is putting the id number in the comments box rather than the username.Dave

I said that might happen. We can't tell you what the expression would be without seeing the row source of the combo box. To get the username go to the properties of the combo box and click on three dot on the far right of the Row Source. This will display the Row Source query. Note which column the username is in. The index of the combo box is zero based so for example if the username is in the second column its index is 1 In this example you would access the username with

[nameofcombobox].Column(1)

where nameofcombobox is the name of the combo box.

I don't have enough information to tell you how to store it. I suggest you do what jdraw suggested.
 
Hi,

Thank you for your reply.

I have attached a copy of the database.

Please see the history tab on the product specs form.

Thanks,

Dave
 

Attachments

David,

I'm going to suggest a tutorial from RogersAccessLibrary that starts with a clear description of the "business" involved and a repeatable process to identify the table, the fields and the relationships involved. It takes about 30-45 minutes to work through the tutorial. You will learn about building an ERD that is the blueprint for your database.
 
Last edited:
easiest way: get the windows user name using environ.

when you store the comments, something like this.
enter the comment into an unbound textbox called [tmpcomments]. Have another hidden control bound to [comments].

have a button that says "Save Comments", and use something like this code

Code:
 if nz([tmpcomments],"")="" then exit sub
 [comments] = environ("username") & "-" & format(date,"dd/mm/yyyy") &": " & [tmpcomments]
 [tmpcomments] = ""
 

Users who are viewing this thread

Back
Top Bottom