Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

option group controlling a text box

Status
Not open for further replies.

cyberbob999

Technical User
Jun 26, 2003
23
US
I'm new to Access, and even newer to VB...so hopefully this will be an easy question to answer.

I would like to be able to display/edit [comments] in a text box that is controlled by an option group (or toggle buttons? ...or whatever is easiest!) Each record has a variable number of comments associated with it. I want to control which [commentnumber] is displayed in the text box based on which record is displayed ([IDnumber]) and the dynamic user selected [commentnumber].

It seems like this should be as easy feat to accomplish, but I can't figure it out. Any help would be greatly appreciated!

Thanks
 
Need a little more information. Are we talking about one table or two? How are the comments linked to the option group?

This data senerio could be set up several different ways and not knowing how the data is set up and how relates to each other makes it pretty impossible to point you in the right direction.

Expand your information and we will give it a go.
 
okay...here's the story:

I have one table (Audits) that contains all of the information about a record, with the exception of the comments related to the Audit. Since there is always a variable number of comments for any given Audit, I set up a different table (Audit_Comments) that contains [Audit_number], which is linked to [IDnumber] in the Audits table, [Comment_Number], which distinguishes between comments for the SAME Audit, and then [comment], which is just the actually comment. My option group (for which I currently have 10 buttons because I do not know how to dynamically change the number of buttons based on the number of comments for a given audit) is [choice]. So, basically what I want to do is this:

text_box = Dlookup("[comment]","Audit_Comments","[Audit_number]=[forms!IDnumber] AND [comment_number]=[choice]")


This actually works, with the following exceptions: Since I'm using "Dlookup," I am unable to edit the comment and also the text box does not refresh when I update [choice] (a problem that seems easy to fix, but I don't know what code to put in the "After Update" field to make the text box refresh).

As you can see, I have about enough Access/VB knowledge to fill a thimble...so, ANY words of wisdom (or even helpful references) would be greatly appreciated...

 
Ok, there are probably several ways to do this but I am going to give you what I would do which, considering what you are trying for, is probably the easiest (in my opinion).

I would create your main form with the Audits table. Create the option group and name it something like grpChoice. Then create a sub form using the Audit_Comments table with the fields comment_number and Comment in text boxes. Place that form on the main form and enter this into the Link Child Fields
Audit_Number;Comment_Number

and in the Link Master Fields put
IDNumber;[grpChoice]

Then when you choose different option number you should see the corresponding comment in the subform. You will also be able to edit it and even add comments if you want through the sub form.



Hope this helps.

OnTheFly
 
That's very helpful, thank you! I wasn't thinking about it in that way at all! Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top