473,626 Members | 3,936 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open a Form based on a combo box result.

4 New Member
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 2196
PhilOfWalton
1,430 Recognized Expert Top Contributor
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
rlvarga0624
4 New Member
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 Recognized Expert Top Contributor
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
rlvarga0624
4 New Member
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, 184 views)
File Type: docx tblTempInput1 Design View.docx (894.0 KB, 178 views)
Oct 14 '17 #5
PhilOfWalton
1,430 Recognized Expert Top Contributor
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
2815
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 DeptId is equal to 1 then fromCargoEntry should open on top of the current form for data entry. Can someone help me with the correct phrasing? My main form is frmNewJobs. Thanks. Karen
1
5309
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 in add or add new record form. The query will return one to 0 records so this is my option. Im guessing the form load event would be the place but not sure how to go about it.
6
3529
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). I'd like to be able to have a user click on the say, RECEIVE PAYMENT button that will open the payments form. This form should open to the loan that was selected from the LOANSELECT box. This form also has a box on it to switch to different...
2
2952
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, if Teacher B is chosen from the list, then data entry form Y is opened. Any thoughts? Thanks much Sheldon Soman
1
2326
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 estimate categories however. The siginificance is, all of the estimates are in the same table, but there are different forms for viewing and editing each type. Each estimate record has a field for EstimateType. The user selects an estimate from...
10
3045
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") combo box 2 named "cbowwselect" displayed as "wk" based on qry Qry WkList (field: Year, wk) displaying only wk field. OPEN FORM (2) BUTTON (@@@)
11
11936
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" What I want to do is, based on the selection of my "Staff Initials" combo box, when I click the "OK" button, I want the Multiple Items Form (Test 2) to open that correspond only to that "Staff Initials". See Picture DB2 and DB 1. I'm really new at...
1
1704
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 the PersonID to be automatically populated in the first blank record so that I can add an account, I would also like the next new account to add the same PersonID in the same way that that a Subform would do it. Can anyone help with this? Thanks
3
4519
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 variables then: FORM.RecordSource = SQL . Works fine but, if I wish to make changes is a hard work. The question is: Is here any way to pass values directly to the RecordSource query ? The same question for a ListBos RowSource.
2
1749
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 created another form (frmUsers) that lists user information (name, email, department, etc.) that has a subform that lists all the accounts the user has on a particular application. I would like to be able to have a manager go to frmManagers, find...
0
8199
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.