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!

Type IDs Into Text Box and Copy Item Texts Into One Field 1

Status
Not open for further replies.

infinitx

Technical User
Feb 26, 2004
212
US
Hi,

I have items in the database that all have Item Texts and unique Item IDs.

On a form, I want the user to be able to type in the Item IDs into a single Text Box, (ex. "1, 2, 3") and for the Item Texts of those Items to all be copied to one Text Box.

Is this possible?

Thanks,

Alex
 
Some infos on the table(s) structure may help us to help you.
And what have you so far ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for responding!

Also, the Items have Case Texts attached to them. So I need the Items' Item Texts and Case Texts to be copied onto one Text Box

Items Table

Item ID
Item Text

Case Table

Item ID
Case Text

The two tables are linked by Item ID.

I have other tables in the database, but I think you only need these for the problem.

Thanks,

Alex
 
Why not using a ListBox with RowSource set to something like this:
SELECT [Items].[Item ID],[Item Text],[Case Text] FROM [Items],[Case] WHERE [Items].[Item ID]=[Case].[Item ID];
To avoid future headaches try to not use reserved words (like Case) for table or field names.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks

But how do I copy the selected items' Item Texts and Case Texts into one Text Box using a Command Button?
 
Hi Infinitx,
What your seeking to do, seems very uncoventional...trying to put more than one record in a text box?
If I've inderstood you correctly, your need, I would populate a "list box", with the records you desire.
I, for example, would create a SQL statement, with the "where" statement dictated by the text box entry.
Then the command button would change the recordsource of the list box, showing all the records found which matching ID's...
This is a brief explanation, not sure if you already now how to implement the methods I mwentioned.
Hope this offers some insight.
if not, I'll be happy to elaborate!
good luck!
 
Provided your listbox (say myLB) allows MultiSelect, you can try something like this:
s = ""
For i = 0 To myLB.ListCount - 1
If myLB.Selected(i) Then
s= s & myLB.Column(1, i) & " " & myLB.Column(2, i) & vbCrLf
End If
Next i
myTextBox.Value = s

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
dboulos,

The reason why I am copying both the case text and the item text for all of the items into one text box field is because I need to export multiple items to word using word merge (multiple items to the same document) to creat a scholastic test, but I can't get it to work and thus I just export everything that is in that one text box. If you know how to export multiple items to the same word document, that would be great.

PHV,

Correct me if I'm wrong, I don't think it copies everything to one text box. What is the code for that?

Thanks again for responding,

Alex
 
myTextBox.Value = s

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,

One more question: Where does the code that you provided go? (What Event)
 
In the AfterUpdate event procedure of the listbox, I guess

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top