This is the SQL behind the Combo Box (Did it this way so you can see the names) - SELECT TblPNRate.PartID
-
, TblPNRate.PartNo, tblRiskLevel.RiskLevel
-
, TblPNRate.Rate, TblPNRate.EffectiveDate
-
, TblPNRate.Obsolete
-
FROM tblRiskLevel
-
INNER JOIN TblPNRate
-
ON tblRiskLevel.RiskId = TblPNRate.RiskID
-
WHERE (((TblPNRate.Obsolete)=False))
-
ORDER BY TblPNRate.PartNo;
I had to have duplicated PartNo so we could keep the old data for the old rate when we make a rate change. So when I put in the PartNo with the new rate I put in a check in the check box to mark it as inactive. With the above SQL or Query filter, it removes it from the list, but the problem I have is when I go back and look at older records the PartNo box will be empty. If I reactivate, (Uncheck the box) it show s up again. Is there a better way of doing this so I don't lose the inactive PartNo/Rate combo and not have it listed in the combo box?
Thanks for your help and wisdom. I only hope one day I can be as helpful to someone on here as you guys have been for me.
21 2080
I think your problem is that yo have "hard coded" the WHERE clause.
It should read something like -
WHERE (TblPNRate.Obsolete = Forms!MyForm!MyCheckBox)
I leave you to substitute the correct Form & Check Box Names
You may need in addition -
Sub MyCheckBox_AfterUpgate
-
MyComboBox.Requery
-
End Sub
Phil
Changed the where section per your suggestion - WHERE (((TblPNRate.Obsolete)=[Forms]![SubAsmParts]![Obsolete]))
Now when I run it everything is blank.
Maybe my approach to how I have this combobox set up.
Is SubAsmParts is a subform?
Anyway, the WHERE Clause should refer to an Unbound Checkbox on your main form which you set to True or False to select the records you want to see in your Combo Box.
See my original post. Sorry if it wasn't clear.
Phil
Yes SubAsmParts is a subform.
So I'm going to Make an unbound Checkbox on my main form and add the above sql or make a query in the row source that's going to control what is visible only in the combobox...???
To be honest I'm still a little confused, but will give it a shot and see what happens.
I may have misunderstood you, but my understanding is that you want to be able to show either obsolete parts or current parts in your Combo Box.
Therefor you need a method of selecting which type of box, and the simplest method is a Check Box ChkObsolete on your main form. If this is True (Ticked) and assuming TblPNRate.Obsolet is a Yes/No field, we compare that Yes/No field with the Check Box and get only records where TblPNRate.Obsolet is also Tue & vice versa
I should have asked- is the Combo box on the main form or subform?
Phil
Combo box is on the subform
I only want the combobox to show current(Yes box unchecked in the table)
But I also want it to show the Inactive ones that were selected before they went obsolete/Changed.
Really do not want the users to check or uncheck anything.
Just want the inactive(Ticked yes) to be hidden from the drop down list only.
I hope I made this mud a little clearer...
As always Phil thank you and you're the best for helping this thick headed American.
Flattery will get you nowhere.
So in our original posing what exactly did you mean by "is when I go back and look at older records the PartNo box will be empty?
Phil
In the query I have a field name of Obsolete and in the criteria box I have false, which filters out all the obsolete part numbers, which this part of it is good.
Lets say I go to record 2 of 150, if I mark a part obsolete and go to this record the part number field for that record will be empty. I look in the table and its still there so I'm guessing it is hidden, but it needs to be visible.
Exactly, what is the RowSource, ControlSource, Bound Column, No of Columns and Column Widths of your Combo Box?
Possibly two screen shots of the Data Tab & Format Tab in the "Property Box" for the Combo might help, but I also need to see the RowSource.
Phil
Ok, I'm from work now. I'll gather all of this on Monday
Thank you again and have a great weekend.
Row Source - - SELECT TblPNRate.PartID, TblPNRate.PartNo, tblRiskLevel.RiskLevel, TblPNRate.Rate, TblPNRate.EffectiveDate, TblPNRate.Obsolete FROM tblRiskLevel INNER JOIN TblPNRate ON tblRiskLevel.RiskId = TblPNRate.RiskID ORDER BY TblPNRate.PartNo;
Control Source - PartID
Bound Column - 1
Column Count - Currently 5 - 0", 1.35", 0", .65", 1"
Well the Rowsource shown between the Code tabs -
SELECT TblPNRate.PartID, TblPNRate.PartNo,
-
tblRiskLevel.RiskLevel, TblPNRate.Rate,
-
TblPNRate.EffectiveDate,
-
TblPNRate.Obsolete FROM tblRiskLevel
-
INNER JOIN TblPNRate
-
ON tblRiskLevel.RiskId = TblPNRate.RiskID
-
ORDER BY TblPNRate.PartNo;
-
Does not agree with the Row Source -Query.jpg.
There should be the Where Clause as in the QBE example
Phil
- l, TblPNRate.Rate, TblPNRate.EffectiveDate, TblPNRate.Obsolete FROM tblRiskLevel INNER JOIN TblPNRate ON tblRiskLevel.RiskId = TblPNRate.RiskID WHERE (((TblPNRate.Obsolete)=False)) ORDER BY TblPNRate.PartNo;
My apologies, I forgot I took it off for a temporary fix I put in place till we get a good permanent fix.
I Still need help with this...
Please and thank you.
zmbd 5,501
Expert Mod 4TB
DJ,
Let me digest what PhilOfWalton has suggested and read through your posts a second time. I thought PhilOfWalton had you the right track; however, maybe I can explain his idea from a different angle... :)
Turn off limit to list. That will at least show the bound value of the items not in the combo box. You can add an unbound textbox with a dlookup if you want to pull a different value to show the user a more descriptive value.
zmbd 5,501
Expert Mod 4TB
You beat me to it Rabbit :)
zmbd 5,501
Expert Mod 4TB
Thinking about this the root of your issue (IMHO) is that your information isn't normalized enough.
What I am reading is that you have (Simplified form!):
[PK][PartNum][Cost][Effective][...]
[1][abc123][$100][2018-01-01]
[2][abc123][$200][2018-02-02]
[3][abc123][$200][2018-03-03]
When what you may want to consider is:
[tblParts]
[PK][PrtNum][Description]
[1][abc123]
[2][hij456]
[3][xyz789]
[tblPartEffctvCost]
[PK][FK_tblParts][Cost][Effective]
[1][1][$100][2018-01-01]
[2][1][$200][2018-02-02]
[3][2][$300][2018-03-03]
[4][2][$400][2018-01-01]
[5][2][$500][2018-02-02]
[6][3][$600][2018-03-03]
(once again, I'm only showing the pertinent information)
This should simplify your rowsource as you feed it the SQL for [tblParts] ; however, it may complicate some of your other work.
Otherwise there may be a kludge method by attempting a circular reference within the current record and the on_current event (!!!YUCK!!!) which will become slower and slower the larger your database becomes as the calculation and requery will happen for the entire form-recordset
OR
Do as Rabbit has suggested. In which case you can attempt the before_update event to limit any changes made to the recordset - less kludge but subject to some glitches.
Rabbit's suggestion didn't work for me, as I need [PK]PartID and a few other fields are used to control 2 of my control's on the form. Risk Level and Rate are dictated by PartID, which I have hidden with a 0" width. I can make all the others go away, but will still need PartID and PartNo in the format tab. With having these 2 it won't let me turn off limit to list.
zmbd 5,501
Expert Mod 4TB
DJRhino1175:
Property Sheet
Data: Limit to list:= Yes
Data: Show Only Row Source Values:= No
[yes I'm actually playing with this form... working on an idea that Rabbit gave me in another thread :) ]
NB:
IF user selects new part number AND old part number isn't in list AND saves record
THEN
The user WILL not be able to undo the change and revert to the former value.
You may want to error proof your control in the Before_Update event such that you check the old value against the row-source values: - Logic before_update
-
Is the former value within the current rowsource
-
Yes the continue with update
-
No then prompt user to confirm change because it cannot be undone.
ZMBD,
This seems to be working, I figured it would be something simple. I will work on the before update code. Not 100% sure at this point, but I believe we will not "ever" update to the older version of that PartID/PartNo, once it changes, but you never know....
Thanks a million for your assistance.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: kk |
last post by:
Have 2 problems, any help is appreciated.
Tab with Grids
--------------
BL - fetching data from DB ( 5 secs - 10 rows)
Grid Laod - 20 secs
Grid Paint on tab change - 20 secs
Problem: The...
|
by: kk |
last post by:
I have 2 issues, please help !
1st issue :
--------------------------------------------------------
Loading Grid
------------
1) creating new rows in a datatable and adding data a
array...
|
by: Jeff_F |
last post by:
Hi all. Question in two parts. I'm looking to add two combo boxes.
The first will contain regions and the second will contain employee
names which correspond to the region selected in the first...
|
by: Tom G |
last post by:
Hello,
I need some advice on which way to resolve the following. On a form, the
user will make a selection from a combo box, after the selection several
different fields need to be updated on...
|
by: jkincaid |
last post by:
I need help on a simple database, I have limited ACCESS skills.
Here's my dilemma:
I have 2 tables:
Table one is customer issues
Table two is the particular customer
Table one includes:...
|
by: Rotsey |
last post by:
Hi,
I am having a problem trying to select an item with the enter key.
I want to work the combo with the keyboard.
So when I use the down arrow to browse the list I want to then
hit the...
|
by: biganthony via AccessMonster.com |
last post by:
Hi,
I decided to install Office 2003 Service Pack 3 on my home computer to test
(in full knowledge that there may be some issues with it). After installation,
I have noticed that with a small...
|
by: flymo |
last post by:
Hello All,
I've bee trying out access 2007 and have a weird issue and would like
to see if I'm issing something really basic.
I have a form based on a query, I create a combo to look for records...
|
by: mistyblu |
last post by:
I wrote an Access97 application using VBA for a company many moons ago and they have approximately 20 users. All has been hunky dory for a long time but suddenly they have a combo box error on 3 of...
|
by: Redbeard |
last post by:
Hi All
I am using Access 2010. My Access Database is slow when moving between records on a form when my cursor is in certain Combo Boxes. When the cursor is in any other field, weather it is a Text,...
|
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
|
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...
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |