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

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?

Related

Issue w/ Cascading Combo Boxes deleting field values from records they pull from for Form

My apologies if this question has been answered before but I've searched all day today and haven't been able to find the answer I seek. I'm building a database for requesters to submit requests to order paint using combo boxes that pull from a PaintCatalog table, broken down by ProductName, ProductColor, Nomenclature, UI, StockNumber, DuplFieldCd (I use this a unique key for paints with the same product name but come in multiple colors and Units of Issue.) I've been trying to set up a form to pull the data into cascading combo boxes from this PaintCatalog, with each selection reducing the dropdown choices until it reaches only 1 choice, at which point it autofills specific fields. Then the user clicks a command button and the values in the form fields are used to create a new record in the PaintRequests table. I've got most of that to work, however when I delete values from form's combo box fields when I'm retesting the form, one of the records in the PaintCatalog starts to get blank values. I need this issue fixed before I can progress any further. I've tried using a query instead of referencing the table directly, but the data is still getting edit, deleted, or overwritten. I'm getting that pencil icon every time I'm using one of the form combo box fields. Please advise.

Lookup tables displaying number instead of text [duplicate]

I am trying to create a report putting a field called contact which has the name of a person. This name is linked directly to another table where I keep all the contacts.
For some strange reason, when I include this name (which in query view displays as the name of the contact), instead of the name appearing, the unique ID number is shown on my report.
As mentioned in the article cited in the above comment, you can use a Combo Box control on your report to do the lookup for you. To see how this can be done, create a new report based on the table containing the lookup field, then drag and drop that field onto the report. That will create a Combo Box control with properties that look something like this:
Row Source: SELECT [Clients].[ID], [Clients].[LastName] FROM Clients;
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
You could use a similar Combo Box control on your actual report to display the client's name rather than their numeric ID value.
Another alternative would be to change the Control Source of the report's Text Box control to have it do a DLookUp() on the table. If the lookup field is named [client] then changing the Control Source of the Text Box to something like
=DLookUp("LastName","Clients","ID=" & [client])
would also work.
I wanted to add to the great answer by Gord:
When using a "web" database (started in Access 2007 I think), you cannot change a report's fields to ComboBox style, nor can you use DLookUp(). (web databases lack a ton of features)
The workaround for this, if you want to create a Web-Report that uses lookup fields, is to create a Web-Query first based on your Web-Table (all the Web-* stuff has a www planet icon over the logo, if you create a new Web-DB in Access 2007+ you'll see what I mean)
So, instead of Table -> Report, you'll have to do W-Table -> W-Query -> W-Report.
Then, the only thing you need to customize to get the data right is the W-Query. Start by trying to reproduce the look in the query to match what you want users to see in the report. Note that here in the query, lookups will work fine (instead of the unique ID's, you get field names like you want). However, this will not carry over to the report. To do that, you gotta get the actual text field name you want into the query:
You should already have one table in your query; start by adding the table that your first lookup field points to. For example, the table I want to print is called Stock_Boards, and it has a lookup field called PCBID_lookup that points to the table Stock_PCBs.
Since you're using lookup fields, there should already be a relationship line between the two tables when you add the second one. If there isn't, something has gone horribly wrong.
Now, see how that line connects two fields on the two different tables? For example, I've got my PCBID_lookup field on my Stock_Boards table, which connects to the ID field on my Stock_PCBs table. If I created a report from this now, PCBID_lookup would be a number, a number that correlates to the ID of a record on Stock_PCBs.
To fix it, I will add the name field I want to show up on the report. In my example, that happens to be a Part Number, rather than the ID. I add the PartNumber field from my Stock_PCBs table to the query, and remove the PCBID_lookup field of the Stock_Boards table from my query.
Since PartNumber is what I want to show up on my report, it effectively replaces the original field (PCBID_lookup)
Repeat for all lookup fields you want in your report.
I had 1 more: I removed the Status field of the Stock_Boards table (which was an ID/Lookup) and added the 'Status' field from the Status table (which was the actual text name)
When finished, your query should look exactly how you want the data to appear, without any special tricks or asking Access to do something unnatural. Save your query, and create a web-report from it. Done!

Access form must be opened twice before combobox values will appear

I have a checklist that is used to perform QC audits. When a reviewer answers a question that requires an exception, a pop-up form will open with the correct exception detail already populated. They then have to provide some further information, which I have set-up in the format of a combobox for a field named 'Condition_Detail.' Some exceptions have only one condition that would be an option in the drop-down whereas others have multiple possible conditions, which is why I don't have that field automatically populated as well. I have a table of possible exceptions and conditions that I have used to create the combobox query. When the database was created, the field the 'Condition_Detail' combobox is dependent on was labeled 'Exception Detail' with a space and in my new table it is called 'Exception_Detail.' I did this because the old data and tables will eventually become irrelevant and I know that it is easier to write code with underscores instead of spaces. I include this information because I had to create a relationship between those two fields in the combobox query so that the database would know they are the same. When I test the database, the form opens as expected with the exceptions already populated (NOT in combobox format - the data appears as text on the form). The issue is that when I select the combobox, it is blank. If I answer the exact same question the same way to trigger the same exception to open in a new record, the combobox does have the correct data in it. I have tried to requery the field both when the form loads and after it updates. It still won't show the combobox values unless I trigger that the form open twice with the same detail populated. An additional piece of information that likely doesn't affect the problem is that the combobox is set-up as three columns so that I can populate two additional fields when the condition detail has been updated. I used the code below to populate that, which works perfectly when I can get the condition detail to appear in the combobox:
Private Sub Condition_Details_Change()
Me.Responsible_Position.Value = Me.Condition_Details.Column(2)
Me.Severity_Description.Value = Me.Condition_Details.Column(3)
End Sub
Thanks in advance for your help!
I figured it out. The relationship I created within the combo box query was unnecessary. The query was searching for values in the table that stored the actual responses/conditions instead of the table that stored the available response options. Because of this, once I had answered the question it knew what to look for, but in the wrong place. Setting up the combo box the usual way with the look-up control value in the form referenced as follows was sufficient to get the combo box to work properly.
Field: Exception_Text
Table: tblPreCloseExceptionDescEnc
Criteria: [Forms]![frmEncompassExceptions].[Form]![Exception Text]

Multivalue combobox creates multiple records in form

I have a form that has multiple comboboxes. Some of them allow multiple values and some of them don't. One of the comboboxes that allows multiple values is causing duplicate entries in the form records.
I can't find any differences in the property sheet between the combobox that isn't working and those that are.
Example fields in the form:
Patient Account Number
Date of Admission
Location of Patient (combobox that allows multiple values; working correctly)
Interface Used (combobox that allows multiple values; working correctly)
Interventions (combobox that allows multiple values; NOT working correctly)
When I select more than one Intervention it duplicates the record within the form. I have 5 patients entered into the form, but one of them has 3 Interventions selected. So instead of showing "1 of 5" records at the bottom of my form I see "1 of 8" and 3 of them are exactly the same. When I look at my parent table though, there are still only 5 records.
Please forgive me if I didn't call something the proper name. I'm very new to Access. Thank you! I tried to add screenshots, but I don't have enough reputation points.
I suspect that the form's underlying query (=RecordSource) is using the Value property of the multivalue field. If so, remove Value from the query.
view the query's SQL and look for the word .Value
remove the word Value and the period before it then re-run the query the results will change back to normal amount of records and so will your form or report.

use access form to edit data from a query result

I'm brand new to Access 2010, well to Access in general. I have a query that returns 10 columns (the query is called pending_review, the source is a table called escalations) in the results, some of those fields are blank since they have to be reviewed. One of the resulting columns is the primary key.
So this is my problem: I need a to create a form where I can type the primary key and the fields on the form will populate with the info from that row so I can fill the blank spaces with information that I now have and then update the table.Once the table is updated, that row should no longer show on the query results.
What I have done is that I created the form, but I don't know how to do the part of typing the primary key and everything gets populated. A solution would be to make a combo box that shows me the primary keys of the rows in the query results, so that every time i edit something in one of those fields for the query to be run again and reduce the number of options in the combo box.
Question is, how do i do that? or is there an easier and better way to do it?
Thanks in advance!!
Can you not just create a new form using the pending_review query as a data source? Access makes it very easy--you can just use the form wizard. This gives you a form in which you can edit one row at a time. Presumably the pending_review query has a filter condition that checks for certain fields being blank (null) or not. If you finish editing a result row in the form, and refresh the form, the row should then disappear from the form because it will no longer be returned by the pending_review source query.
Even if you need to do something more complex, this should at least be a good start.