Non-Index Value Display Issues in Combo Box - ms-access

I am creating a data entry form for employee information in Access 2016, which contains a fairly standard subform for work history.
In this subform, I have a SQL query to limit the items being pulled. The query itself works fine and is returning the correct results.
It essentially chekcs if the job position is open, (i.e. does not exist in history without an end date), or if it is the same as the current record.
The problem I am having is that I cannot seem to make the desired text display consistently.
The combobox itself is pulling 3 fields; job_id (index), job_title, and shift (job_title and shift are a unique combination, with job_id just being an autogenerated number).
The actual value being stored is the job_id, but I would like for the combobox to display the job_title after being selected.
This displays correctly when it is first selected, but if I then select a new job_id on a different record (where an event to requery occurs), any item without an end date stops displaying.
I have an event to requery this combobox on getfocus. I am almost positive that the problem has to do with anything missing an end date re-querying, and then not finding itself in the list, and then displaying a blank.(The data itself is not being deleted, just the display)
If I allow the index-column to be displayed, it no longer shows up as a blank, but it only displays the ID number which is not inherently useful to the end user.
If there is anything I can do to clarify please let me know.

Related

SSRS - Issue with Cascading Parameters Selection Refresh

I have cascading parameter that contains list of employees that produced reports for a certain date period. The parameter Employees is multi-select list and it's cascading parameter, i.e. depends on Beginning & Ending date parameters, so only employees that were active in this period will be displayed in the dropdown.
Here is the issue - when I modify dates to a longer period, my Employee list expands (so refresh happens correctly), but among all employees only those are selected, which were part of previous list, before changing beginning/ending date parameters. I need Employee list always to be SELECT ALL by default. SELECT ALL option does appear in the list, but it's not being selected after the refresh.
This SELECT ALL requirement is important as users may run report assuming all employees are selected, which in fact will not be the case, so current functionality is very misleading.
For your knowledge, default values for the Employee list are the same as Available values - getting list of employees from DB query based on period specified.
Appreciate your help on this matter.

SQL Rowsource not working anymore after loading in values from another table

I have created a form whose comboboxes get "DISTINCT"-populated with values (from a table), which means nothing is selected at first, but the combobox offers a load of values to select from named table. In Field 1 I select a value and then Field 2 automatically loads in only values from the table where the criteria fits the value from the first field and so on. This way, I am narrowing down the numbers of applying recordsets from my table down to 1 or 2 just by clicking and choosing options. My Form looks this way.
I have a total of 16 rows where in each row I can narrow down parameters to 1 specific item from the table.
With pressing a button, I can write these values into another table where they will get a save ID and a save name. This all works flawlessly.
I also added a loading button, where I can select the savenames from the savetable and the form will automatically get filled with the values from the savetable. But as soon as I do this, no values are suggested anymore in the field that contains multiple Columns. I tried a Requery, I tried reassigning the Rowsource, I tried just deleting the values in the fields before, nothing helps. I have to use my "erase" function where I set all fields to "Null" to be able to get the "suggesting values" back to work.This is how it looks after loading
In the regarding field should be at least 3 values which get not displayed anymore.
It feels like filling the forms' fields with comboboxname.value = rs!valuefromsavetable deletes or blocks the rowsources from working.
Can someone help me here?

Delay loading records of subform

I have a form with search fields and then the search results are shown in a subform below the search fields.
By default the subform loads all records prior to any search criteria being entered.
As this database grows the number of possible records to search will get quite large, so I don't really want the subform to load all records before the user attempts to makes a search.
What's the most performance-friendly way of loading the search results subform without showing any of the records to begin with?
I've considered setting the subform recordsource SQL to search for something I know will never be in the results... but I'm thinking that still requires the records to be loaded first and then filtered (might be wrong about this though).
Ideally I'd like the search results subform to load with the field names of the recordset only, but with no records until the user attempts a search.
Set the subform's record source to a query which returns a single manufactured row.
SELECT
0 AS id,
'' AS fname,
'' AS lname,
'' AS email
That will not pull any records from your table.
After you gather the user's search criteria, build the new SELECT and assign it as the record source.

Combo box that finds a record, is bringing up multiple fields

I have a combo box on a form that when you pick the month it will brings up all the jobs for that month in a subform.
This was working perfectly until I wanted to change some fields so I deleted the combo box and when I put a new one it brings up the month for every single record, i.e.
January
<br>January
<br>January
<br>April
<br>April
<br>May
<br>May
<br>May
etc etc..
How do I change it so it just brings up only one January and so on?
Please post your table structure, so we can determine what the problem is.
Without it I will do a wild guess and assume that the DISTINCT clause in the combobox query is missing.
What you have:
SELECT Jobs.JobDate FROM Jobs;
What you should have:
SELECT DISTINCT(Jobs.JobDate) FROM Jobs;
But again: if this does not solve your problem, post the table definition.

Calculated control does not recalc automatically

Firstly, a bit about my setup.
I have a primitive database of three tables:
A. Table that lists various locations: [location_code], [location_name]
B. Table that describes items: [item_code], [item_name], [item_price]
and finally a table that ties the roo^H^H^H whole database together
C. Table says which items are stored at each locations and in what quantities: [location_code], [item_code], [item_quantity]. This table can have multiple entries with the same [location_code], since different items can be stored at the same location. Basically, this is a schoolbook implementation of one-to-many relationship from locations to items, with a extra attribute (quantity) attached to each location-item link.
Now, all I need to do is to create a form that would list all items stored at certain location. This is a basic use-case for "subform" feature in Access. The main form simply navigates through different locations, while the subform lists the items.
I use
SELECT C.location_code, B.item_name, B.item_code, B.item_price, C.item_quantity
FROM B INNER JOIN C ON B.item_code=C.item_code
as a record source for the subform. The main form is linked to subform by [location_code]. The subform is set up with list layout (not table layout), i.e. each database field is given its own control element.
So far everything works perfectly. I select the location in the main form, and the subform gives me a list of editable [item_name]-[item_price]-[item_quantity] triplets for the current location.
As the next step, I want to add a calculated control to each of the above triplets. I want to know the total price for each kind of item (i.e. simply the [item_price] * [item_quantity] in each line). Easy, I add a calculated control to the "repeatable" area of the subform and specify
= [item_price] * [item_quantity]
as the formula for the value. Again, everything works perfectly. Now instead of the above triplets, my list has four entries per line: [item_name]-[item_price]-[item_quantity]-[total_item_price]. And, what is important, when I edit [item_price] or [item_quantity], the [total_item_price] gets automatically reevaluated once I finish editing.
And as the final step, I want to add another calculated control that would display the total price of all items stored at the current location (let's call it "grand total"). A also place that control into the subform (into the "footnote" area this time) and specify the following formula as its value
= SUM([item_price] * [item_quantity])
Now, this works. The total value is calculated correctly each time I change the location in the main form. Also, when I change [item_price] for any item at the current location, the grand total is also updated automatically. However, when I change [item_quantity], the grand total does not update (???). Hitting F9 will make it update. Changing the current location back and forth will update it. But, unfortunately, a mere change to [item_quantity] does not trigger an automatic update.
Does anyone know, what could be wrong here? Why do changes in [item_price] trigger the automatic update of the grand total, while changes in [item_quantity] do not? Intuitively, these fields seem to have the same status (except that the former comes from table B, while the latter comes from table C). Why is the behavior different? How do I make it update automatically?
In your subform's after update event, explicitly recalculate the total price control.
Me.txtTotalPrice.Requery
If you tab through the record and advance to the next record does it still not update. I am thinking that the price is the last field in tab order so when you change it, you tab on to the next record and the change is committed. If I am right then when you edit the quantity, your tab advances you to the price field which is still in the current record so the change is not committed to the table yet. If you advance further through, that should complete the processing.