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

Populate tables from listboxes 1

Status
Not open for further replies.

Domino2

Technical User
Jun 8, 2008
475
GB
I have a form with 4 listboxes on. Listbox1 is filled with directory names. Listbox1b is filled with word document names found in the direcory selected in Listbox1. Listbox2 is filled with subdirectory names found under the directory selected in Listbox1. Listbox2b is filled with word document names found in the subdirectory of the Listbox2 being selected.

I am struggling to cycle sequentially through the listboxes to enter the listbox values into a sensible table structure. Before I start slogging it out, has anyone any suggestions on where to start. Thanks
 
What's your "sensible" table structure look like?
A normalized table structure would look like:
tblDirectory
DirID
DirName

tblSubDir
SubID
DirID
SubName

One-to-many relationship between tblDirectory and tblSubDir.

tblDocs
DocID
WordDocName

Connecting tblDocs to the directories:
tblPathDoc
PathID
DirectID
DocID

where DirectID is either DirID or SubID.
Note: don't use autonumbers.
 
Many thanks fneily, I will sketch that out to see what it looks like and work out a procedure to fill the tables. I think when the table joins are in it will be clearer, thanks again I'll let you know how it goes
 
Also what you could do, in your tblSubDir, by using a Union query, add the word None. Then in the tblPathDoc, instead of DirectID, just have SubID. So the relationships would look like:
tblDirectory ---> tblSubDir ---> tblPathDoc <---- tblDocs

So tblPathDoc is your junction table. Some reading:
Fundamentals of Relational Database Design

So tblPathDoc could look like:
PDA MainDir1 SubDir2 WordA
PDB MainDir1 SubDir3 WordB
PDC MainDir1 None WordA

Sometimes I have two Word Docs named the same, but in different directories. As you can see, the structure can handle it.
 
Many thanks, I will go along with that, thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top