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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiselect list box

Status
Not open for further replies.

Zorro1265

Technical User
Nov 14, 2000
181
US
I tried this on the forms forum but haven't been successful, I hope someone here can help.

I want to create a multiselect list box that will store each selection as a seperate entry in a table. I currently have a listbox that will store several selection but they all go into one entry in my table. The source for these selections is a table with several phrases in it. I would like to store just the reference to these tables not the entire string of text. Also if the user enters something not in the list I want to store there entry in the table. Does this make any sense, can anyone help?
 
Check the following thread, I think it will help you...

thread181-37978

Hope that helps...


Terry M. Hoey
th3856@txmail.sbc.com

Ever notice that by the time that you realize that you ran a truncate script on the wrong instance, it is too late to stop it?
 
I will take a look at this with my VBA guy and see if its what we need. Thanks!!!
 
Hi, I once did this using Access 2 but you can tailor it for Access 2000 if thats what you use.
First, in the Row Source of the drop down box type this:-
Select [PublicationName] From [tbl_Publications];

Then on the event you need to use add this code:-
Dim db As Database
Dim MyRecSet As Recordset
Dim MyAnswer%
Dim MyPublication As String

Dim frm As Form

Set db = dbEngine(0)(0)
Set MyRecSet = db.OpenRecordset("tbl_Publications", db_open_table)

Set frm = Forms![PDF Form]
MyPublication = frm!cboPublication

MyRecSet.Index = "PubName"

MyRecSet.Seek "=", MyPublication

If MyRecSet.nomatch Then
MyAnswer = MsgBox("This is a new Publication, should it be added?", 4 + 256, "Publication Not Found")

If MyAnswer = 6 Then

MyRecSet.AddNew

MyRecSet.PublicationName = frm!cboPublication

MyRecSet.Update

End If
End If
MyRecSet.Close
You will need to use the right table name etc for your particular application but this works by looking at the table to see if there is an entry matching the one the user selected. If so, it carries on. If not, it prompts to ask if the new info should be stored.
Hope this helps
Regards
Phil Smith
 
hey zorro, could you tell me how to get that multiselect to go into one entry like you have it.
John
 
Go to this link

Its microsofts kowledge base article Q140483

It explains all about the process much better than
I could. The only problem doing it this way is you get a larger database since it copies each item and store it as text within your fields. What I want is to have something that will look up the value in a field and just store that reference. Plus values are long strings of text which makes me store lots of data if you values are small it may be ok.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top