Listbox to database

E

Ernst Guckel

Hello,

I have a unique question that I am at a loss as where to begin. I have
two listboxes. lstOne has employee names in it. I move selected names to
lstTwo. From there I want to run a query that adds the data in lstTwo to a
table like so...

Column one contains EmpID
Column Two contains EmpFirst/EmpLast

txtSOSDate contains a date.

tblEmp has employee data (EmpID)
tblSOS has dates(SOSID)
tblEmpSOS has EmpID and SOSID

i want entries in tblEmpSOS with EmpID (Column 1) and SOSID

SOSID does not exist in tblSOS yet. The Date from txtSOSDate needs to be
added to tblSOS before the execution of the SQL for the EMPID/SOSID.

SO where do I start??

Thanks,
Ernst.
 
J

Jeff Boyce

Ernst

In Access, listboxes in forms are not used to store data, even though you
could "hardwire" a list of values into a listbox.

What underlying data is "feeding" your first listbox?

What code is running when you "move" a selection to the second listbox?

And where are you storing the selected names? That is, if you are only
hardwiring names into the second listbox, they are not being stored in a
table.

More specific descriptions will probably result in more specific
suggestions.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
E

Ernst Guckel

Ok... the first listbox gets its data from tblEmployees. 2 columns EmpID,
EmpName

The second listbox is a selection of employees.

and there is a date field on the top. Ideally I want to be able to select
the employees that work on that day (Date in txtbox) populate the second
listbox and then 'join' them in tblEmpSOS.

tblEmpSOS is EmpID, SOSID
tblEmployees is EmpID, EmpFirst, ect.
tblSOS is SOSID, SOSDate

I want to later run reports on who worked on what date...

Would it be better to use a multiselect list box and Add the 'Selected'
names to a table??

Ernst.
 
J

Jeff Boyce

Ernst

That sounds like the direction I'd go...

When I use "paired listboxes", I "feed" the first one from a list of
available persons (or tasks or ...).

When I "move" a selection over to the second listbox, what I'm really doing
is adding a record to a table and requerying that second listbox to display
what's in the (new) table. One example would be signing folks up for a
particular class. The second listbox would be based on a table that hold a
ClassID and a PersonID.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Filter report 2
Need Help... 4
Help Plz... 4
Synchronizing current record with list box 6
intersecting times 3
how to clear a form then requery 1
Pass Filter Value to Another Form 3
Relational query problem??? 11

Top