By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,702 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,702 IT Pros & Developers. It's quick & easy.

Using button to look at table before opening new form, otherwise open blank form

P: 6
I'm really new with Acces and VBA, so all the help with code is greatly appreciated!
I created a form that kind of works like a switchboard (FRM_A) with two combo boxes [Organization (cbo_org) and Staff Initials (cbo_staff_init)]. Both boxes take the information from Table_A. This form has a “Search” button. See attached PDF file DB 1.

When I hit the “Search” button it will open a second form (FRM_B). Form FRM_B is supposed to open for the corresponding “Staff Initials”.

Form FRM_B has the following: 1 Text box for “Staff Initials”, 4 Combo Box , one is called “Activity Code” (cbo_Acode) which pulls the big list from a table called “Activity_Table”. The other 3 combox boxes are named : cbo_A, cbo_B, and cbo_C. All 3 combox boxes are just a “Yes, No, N/A” list.

Form FRM_B also has a List Box (Staff_Activity_List) and a “Save” button. See attached PDF file “DB 2”

How I want this to work is that once I select from the list from all 4 combo boxes, the “Save” Button will store the “Staff Initial”, plus the choices that were picked from all 4 combo boxes: “Activity Code”, “cbo_A”, “cbo_B”, and “cbo_C”. I also need this to store the information from the List Box to a Table (Table_B).


To summarize, the help I need on how to code all this are the following:

- How do I code that when I hit the “Search” Button in FRM_A it will open FRM_B with the record of the corresponding “Staff Initials” that were selected from FRM_A.

- How do I code that when I hit the “Save” Button it will store into the List Box (Staff_Activity_List) the “Staff Initial”, plus the choices that were picked from all 4 combo boxes: “Activity Code”, “cbo_A”, “cbo_B”, and “cbo_C”. Also, how do I make it so that it will also store that information into Table_B.

- And to follow up with the first question: How do I code that when I hit the “Search” Button in FRM_A, it will first look into Table_B and pull all the information that may stored already which corresponds to that “Staff Initial” and insert into the List Box so that when FRM_B opens it will list all the information saved for that “Staff Initial”. Otherwise if no information for that “staff initial” in B, it just opens a blank FRM_B.
Attached Files
File Type: pdf DB1.pdf (15.1 KB, 261 views)
File Type: pdf DB2.pdf (17.8 KB, 260 views)
Jul 23 '10 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,769
rakabuku: How do I code that when I hit the “Search” Button in FRM_A it will open FRM_B with the record of the corresponding “Staff Initials” that were selected from FRM_A.
In your DoCmd.OpenForm() call, pass a WhereCondition value (fourth parameter) that filters FRM_B on the value selected.
rakabuku: How do I code that when I hit the “Save” Button it will store into the List Box (Staff_Activity_List) the “Staff Initial”, plus the choices that were picked from all 4 combo boxes: “Activity Code”, “cbo_A”, “cbo_B”, and “cbo_C”. Also, how do I make it so that it will also store that information into Table_B.
Generally you wouldn't.

You use Access to manage data entry for you. Trying to code around Access is not advised for anyone that would need to ask how to. Those of us that don't, generally would never do so anyway, but I never like to say never.
rakabuku: And to follow up with the first question: How do I code that when I hit the “Search” Button in FRM_A, it will first look into Table_B and pull all the information that may stored already which corresponds to that “Staff Initial” and insert into the List Box so that when FRM_B opens it will list all the information saved for that “Staff Initial”. Otherwise if no information for that “staff initial” in B, it just opens a blank FRM_B.
Not sure what you're asking here, but for how to use forms to filter other forms have a look at Example Filtering on a Form. The concepts are the same but instead of applying the filter, when you have it set up, to the same form, you just apply it to the other one.
Jul 23 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.