gtmathewDallas
asked on
multiple values - list box save-edit
Hi Experts,
I am working on an access form to save multiple values(id's) from a list box to the database field. I have to use those values in another form(may be in the same form) to edit... So my question is, do we have any other better options to do this type of functions(adding multiple value to db and retrieve it update later) in Vba and Access forms..Please help..
Thanks
I am working on an access form to save multiple values(id's) from a list box to the database field. I have to use those values in another form(may be in the same form) to edit... So my question is, do we have any other better options to do this type of functions(adding multiple value to db and retrieve it update later) in Vba and Access forms..Please help..
Thanks
I also do not use multi-value fields. They are really more trouble than they are worth. Create a normal 1-many relationship. Use a subform for the many-side data. Using a subform is essentially a no-code solution. You can make the subform innocuous so it blends in with the main form if you wanted more of a list effect.
The only benefit of using a multi-value field is the nice display options. Everything else is a problem.
The only benefit of using a multi-value field is the nice display options. Everything else is a problem.
ASKER
Thanks fyed and PatHartman,
My requirement is to assign multiple members(users) to different rooms. I have a form and table for room details and from the same form i have to assign the members to it. The form is user defined and not linked to any data/table records.
I was thinking to add two list boxes to the same form - one to select the users and other to show the selected users and then to submit. I am not sure this method is right or wrong but from the user end I think it will be easy for them.
I am not sure how the other method (subform) works.. to save/edit each emplooyee shall we need to go through each subforms? Please Help.
Thanks
My requirement is to assign multiple members(users) to different rooms. I have a form and table for room details and from the same form i have to assign the members to it. The form is user defined and not linked to any data/table records.
I was thinking to add two list boxes to the same form - one to select the users and other to show the selected users and then to submit. I am not sure this method is right or wrong but from the user end I think it will be easy for them.
I am not sure how the other method (subform) works.. to save/edit each emplooyee shall we need to go through each subforms? Please Help.
Thanks
The form is user defined and not linked to any data/table records.Are you saying that you didn't create the form but the users are allowed to create their own forms in a shared database? -- Big problem waiting to happen.
If this is a one to many relationship, the room is actually stored in the member record. If this is a many-to-many relationship, it needs a third table to implement.
I've attached an example of a many-to-many relationship and how to manipulate it from either side.
ManyToManyAXP.mdb
ASKER
Sorry for the dealy - I was off from work.. If i use listbox or combobox - whats the best way to store the data to the table of the selected items from it? save multiple selected items in to a field or any other way to store? May be the answer of this question will give me the solution. Please help.
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What are you trying to do with the values from the list? Normally, if you are going to use a list that allows you to select multiple items from the list, you are going to need a table that stores those in a table with a one-to-many relationship to the main record that the form is tied to.
Unfortunately, that also means that the list will not be bound to the main record and you will have to write those selected items to a table when you save the record, and if you come back to that record (Current Event), you will need to read from your one-to-many table and highlight (SELECT) those items in the list again.
To write the values to a table, you might use code similar to:
Dim varItem as variant
for each varItem in me.lstYourListName.itemsse
strSQL = "INSERT INTO someTable (ID, ListID) " _
& "Values (" & me.txt_ID & ", " & me.listYourListName.column
currentdb.execute strsql, dbfailonerror
Next
written on my iPad, so there might be some syntax errors.