473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Open a Form based on a combo box result.

I've been wrestling with what is probaly silly to most. I created a combo box that lists numbers 1-7 (Days of week). I want to open the corresponding form based on the drop down result.
this is the code i used in the 'after update' code...i keep getting compile errors...I'm probably not holding my lips right, but i've exhausted my limited knowledge.

any Help is greatly appreciated.
Warmest regards
BobV
Oct 8 '17 #1
5 2191
PhilOfWalton
1,430 Expert 1GB
It looks as if all the Psychic advisers are on holiday, Bob.

How on earth do you expect an answer to this question with no more information than something does not work?


Phil
Oct 9 '17 #2
Phil, thanks for the quick reply...the code never made it...here what it looks like ...I think.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cbxTrainingDay_AfterUpdate()
  2. DoCmd.OpenForm "frmDay1Input", “Day= "1" & Me.MyCombo
  3. DoCmd.OpenForm "frmDay2Input",,,"Day= "2" & Me.MyCombo
  4. DoCmd.OpenForm "frmDay3Input",,,"Day= "3" & Me.MyCombo
  5. DoCmd.OpenForm "frmDay4Input",,,"Day= "4" & Me.MyCombo
  6. DoCmd.OpenForm "frmDay5Input",,,"Day= "5" & Me.MyCombo
  7. DoCmd.OpenForm "frmDay6Input",,,"Day= "6" & Me.MyCombo
  8. DoCmd.OpenForm "frmDay7Input",,,"Day= "7" & Me.MyCombo
  9.  
  10. DoCmd.SetWarnings True
  11. End Sub
The other issue I have is when i run an update query, it shows that the records are updated, but when i look at the table, the fields selected are empty...here is the code for the query:

Update query for tblWODDate:
Expand|Select|Wrap|Line Numbers
  1. UPDATE TblMovements INNER JOIN TblTempInput1 ON TblMovements.Movements = TblTempInput1.Movements SET TblTempInput1.MovementGroup = [TblMovements]![MovementGroup], TblTempInput1.[Group] = [TblMovements]![Group], TblTempInput1.[Day] = 1
Any help is hugely appreciated.
Best Regards,
Bob
Oct 10 '17 #3
PhilOfWalton
1,430 Expert 1GB
We'll look at one problem at a time

I am assuming that your combo box is called CbxTrainingDay. If so what is the control called MyCombo? I presume this is where you are getting your compile error as my guess is there is no such control.

Now your current code is using a WHERE condition. I much prefere something like
Expand|Select|Wrap|Line Numbers
  1.     Dim WHEREClause as String
  2.  
  3.     WHEREClause = "XXXXXXXXX"
  4.     DoCmd.OpenForm FormName, , , WHEREClause
  5.  
That way, you can evaluate in the Debug window, the value of the WHEREClause.

Next question have all the forms different layouts and data. If not why do you have 7 separate forms. I suspect your data isn't normalised, so we better have a look at your table structure. The best way to do this is to include an image of your relationship window with the tables fully expanded in your reply.

Phil
Oct 10 '17 #4
Phil,
I've attached the tbleTempInput and Relationship screen shot. Thanks again for all of your help.

Best Regards,
Bob Varga
US Army(Retired)
Attached Files
File Type: docx Relationship screen.docx (341.8 KB, 182 views)
File Type: docx tblTempInput1 Design View.docx (894.0 KB, 176 views)
Oct 14 '17 #5
PhilOfWalton
1,430 Expert 1GB
Thank Bob.

Think we need to get back to first principals as, I hope you don't mind me saying, your relationships do not look at all clever.

So what is the Db supposed to to - what do you want to enter & what do you want to get out?

A very quick thought is that whatever you are trying to achieve, it looks as if there should only be one form based on a single input table, and that form is FILTERED by the day you want to display. I need a lot more information before I (hopefully) can be of more help

Phil
Oct 14 '17 #6

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

Similar topics

3
by: Rosy | last post by:
Hello all. I think my request is a simple one; however, I am unable to figure it out by myself. I need a form (frmCargoEntry) to open whenever the cargo dept is chosen on another field. So when...
1
by: starke1120 | last post by:
Is there a way to open a form based on query type.. Example.. If a certain query result is 1 then open the form to this result.. If the query results are NULL or 0 results, then open open for...
6
by: Markus_989 | last post by:
I have a LOANS table that has a list of loan details for different borrowers. I have a main switchboard with a LOANSELECT combo box (that displays a list of borrower last names and loan numbers)....
2
by: ssoman | last post by:
I was asked if I could open one of two possible data entry forms based on what is chosen in a drop down list. For example, if Teacher A is chosen from a list, then data entry form X opens. However,...
1
by: Kevin | last post by:
The menu form has two options, one to create a new estimate, the second to open an existing estimate. Under option two is a list box containing all of the estimates. There are several different...
10
by: Beatrice | last post by:
I need to open a form selecting all data from a previous form i.e: Form 1) combo box 1 named "cboYearSelect" displayed as "Year" based on qry QryYearList ( only one field "Year") ...
11
by: rakabuku | last post by:
I have this form called "switchboard" and in it are two combo boxes: Organization and Staff Initials (cboOrganization, cboStaff_init). There is also a search button called "OK". See picture "DB1" ...
1
by: Sharkiness | last post by:
My main Person Form has a button to add accounts. This opens the accounts form in Edit Mode. It is a continuous form. I have setup my relationships but when The account form opens I would like...
3
by: Mihail | last post by:
I have some global variables. I use this variables to open a form based on a query with parameters. Now I use the On Load event to prepare an SQL string which include values of the global...
2
by: Smecker | last post by:
I'm working on a database that contains managers, users, and user accounts on an application. I have a form (frmManagers) that has a combo box that populates with the names of the managers. I've...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.