Fill control with previously written text

Dwight

Registered User.
Local time
Today, 00:05
Joined
Mar 17, 2003
Messages
168
This is very simple.....but beyond me.

I have a control on my transaction entry form called Notes. It allows the user to add a brief description about the transaction. Sometimes the note will be a repetive, canned statment. Other times it will be unique.

How would I put a button that would write in the text using VBA?

I could have 3-5 buttons the user could use to select the most common scenarios. This might cover 80% of the time and it would speed things up and reduce typing mistakes.

I am poor at programming but willing to learn.

Thanks, Dwight
 
Put the appropriate number of buttons on the form you want. In the OnClick event of each button you put:

Me.YourTextBoxNameHere="Your Message Here"

Set the Caption if the button as desired.

Do this for all the buttons.

Take into consideration, that if a secons button is clicked when running the form, the first message is deleted. Don't know if this fits your scenario.
 
Last edited:
Sounds like there couldn't be a better way. I'll check it out.

Thanks, Dwight
 
It's much easier and makes more sense to use a combo box of defaults, if you need to add more you won't need extra code or buttons to handle it.
 
following on from Rich's advice by using a lookup table of coded responses you would also considerably reduce the amount of data stored as you would only be storing a reference to the actual text.
 
I like the combo box approach but I have hit a small snag.

I set up a table:

Note1ID (PK) Autonumber
Note (text)

Then I used this table as the row source in the lookup. The idea for the field is really that it should have miscellaneous data but at times it would be repetive. Hence the post.

The snag is that I cannot get the limit to list property set to no and only the column wiht the text to display in the combo box.

Any ideas?
 
I don't think you can set the limit to list to no when you lookup data in another table as that would require a new entry in the source table. I would add a new field for custom notes and an entry in the Note table for 'Custom Note'. You could then set your new fields visibility based on the selection in the combobox(i.e. if its 'Custom Note', make the field visible, otherwise remain/make hidden)
 
I think for the time being I am going to put the buttons back on.

Thanks for the tip Fornation but this field is supposed to be a catch all field so I don't want to do another one. I can see that your method would work though. I'll keep it in mind and may switch in the future.

Cheers, Dwight
 
Dwight,

Combos are great and sometimes much easier to handle, but there's no 'grey area' - meaning either they are limited to the list or they not. You have to limit it to the list, otherwise your users can add new ones, and then you face the risk of getting more than one item in the list that means the same thing! Not good!

I'd to think I would have sticked to the buttons, then you have both possibilities, entering free text or a common one that always stays the same from the buttons used.

However, keep the button count to a minimum!

This is only my 2 øre of advice!
 
Last edited:
i had a similar situation and did this...

built seperate table for comments

combo basedon the table with union query to add a "add" choice to the combo. (combo limited to list yes)

if "add" selected (on change event trigger of combo) used vba to open the comments table, input box to ask for the new comment, check new comment against current values (you could get clever with like* to check bits for similar entries) , append new comment to table if not duplicate, save and close the table, update the combo row source query (list), put the new comment into the combo as its value and set focus to the combo and return to the form erady for the next bit.

It sounds long winded but works like a dream. you have the ability to add to a limited list in a controlled way, without exiting to update bits elsewhere.

there is probably a better way to do it, but i thought of this all by myself - and it worked!

hth
Mike C
 
Sometimes the note will be a repetive, canned statment. Other times it will be unique.
I've done this in my recent project by using a combobox with a value list. [as opposed to a lookup] requires no code or buttons, just a combobox as the contol. [This is, I believe what Rich was describing above]

I list the 11 standard departments for tradeshow crew assignments, but with "limit to list" set to "no" I can also add booth numbers for specific exhibitors. [without adding them to the list of "canned" values]

This is very simple.....
Maybe a better [read simpler] option for you?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom