Need expert help. Don't know VBA. Cascading Combo Issues.

newstrom

New member
Local time
Today, 15:45
Joined
Oct 13, 2004
Messages
9
I don't understand VBA coding or complicated event procedures. If anyone is willing to take me by the hand and walk me through this so I can get it done I would appreciate it.

I am having to set up, from scratch, a filing system for the boss. The problem is he doesn't think in names and companies so I could set up a alphabetical system. He thinks in subject/topics. So I have to categorize everything by topic. I've created the attached database so you can actually find a file once it is file, but I want some special effects on it to make it user friendly since most of the people I work with have never used access and some are computer illiterate. Here are listed some things I want to do.

1. when you click on FileCabinetLocation in the form I want it to bring up only the FileTopics that apply to that cabinet.
2. when you click on FileTopic I want it to bring up only the FileSubTopic that apply to that FileTopic.
3. I want to make a mail merge label that will give a short code combining FileCabinetLocation, FileTopic and FileSubTopic to where the file should be filed so if it is removed it would be easier to file it back. Example Rod's 1, Active Jobs, Woodland Park Saddle Club could be R1AJWPSC. But it need to be logical enough that it doesn't cause confusion and there's no chance any codes could be duplicated. And that the coding would be consistent. Our accounting system has codes for Vendor but sometimes they use the first 4 letters of the company name and the first 4 letters of the second name but sometimes they forget or get confused and it the first 5 letters or the whole first name. I want the codes to be automated if possible so there is no confusion.
4. I want to be able to have the lookup table automatically updated if a new topic is added that is not on the table list.

Regarding 1&2 I researched cascading combos on the access forum and looked at some sample databases but just can't seem to understand the coding and the logic of how to make it work. I did get it to cascade once but it was backwards from what I wanted and it showed the coding rather than the names. I do understant that the 3 file placement look up tables will have to be combined but I seperated them for now so I could get some data in.

I didn't save my work to show what I did previously with the cascade combos and I don't even know that I could duplicate it but I thought if you could help it would save me a lot of time in trying to learn the coding. I've already spent 45 hours on it and the boss needs to start seeing some results. He doesn't understand that setting up a system takes time. He thinks I should be able to just make labels, stick them in a drawer and call it good.

As For 4 I know you have to use the "not on list" event property but I don't know the syntax to make it update the table.

Feel free to manipulate the data, table, form whatever. I will use your changes as a guideline to change the actual database. :o
 

Attachments

Search this site for "cascading combo boxes", I've seen numerous posts in the past.
 
OK. Had a look at your dB. Point one throws an instant problem. You have not related the data in any way, so short of hard coding (very bad practise) ther is no way for the system to know which File Locations are part of which File Cabinets.

The quickest way to get round this is to add a field to the record which records which cabinet a location is part of. Use the lookup wizard to do it for you, which will also create a combo box whihc is limited to the list so you can't accidentally enter something that doesn't exist. I would recommend using the Lookup Wizard for the File Status field as well.

You then set the rowsource of the file location field to
Code:
SELECT tblFileTopic.FileTopicKey, tblFileTopic.FileTopic, tblFileTopic.FileLocationKey FROM tblFileTopic WHERE (((tblFileTopic.FileLocationKey)=[Forms]![Main Entry Form]![FileCabinetLocation]));

and in the AfterUpdate event of FileCabinetLocation, go straight into the VBA and put:
Code:
Me.FileTopic.Requery

The same principle applies with the next field, answering point 2. Remember to change the RowVount property of the combo boxes to 3, and enter 0cm as the width of the third column.

For point three if there is an issue with matching codes your company produces I would suggest not relying on Access to guess correctly, especially if the company deviates from its own policies at times. Just manually enter it.

For point 4, I understand what you're saying, but I would avoid doing it that way. I would require some kind of a prompt for new topics, otherwise the system would dreate a new topic when the user had in fact just mis-spelt an existing one. limit the list to existing topics, and have topic creation on a separate form.

If you really want it on the same form, put a command button on the form, and make the on click event get the details of the new topic. I guess you will need help with that. PM me if you want me to. I'm happy to but I have to go looks after my kids

Nick
 
thanks

Nick, thanks for your reply I will work on implementing your suggestions. I'll keep you posted. I'm sure I'll have more questions as I get further into it.
 
Cascade combo

I think I'm making progress on this.

I used the FileLocationTable to associate the file locations.

On the Main Entry Form I was able to create the drop down for FileCabinetLocation using a SELECT on FileCabinetLocationQ query.

I tryed to create a query (FileTopicQ) for the FileTopic drop down. The query works when you enter the data in the query mode (it lists the FileTopic multiple times because it is read multiple times. If the query is the best way to go on this can it be filtered to elminate the multiples?) but the form didn't read the query so I changed it to a SELECT. It still isn't reading it. I'm wondering if I have my table set up wrong or if my SELECT coding is wrong.

Also do I need to connect the Main Filing Table with the FileLocationTable in the relationships and if so how?
 

Attachments

Users who are viewing this thread

Back
Top Bottom