Multivalue combobox creates multiple records in form - ms-access

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.

Related

MS Access need to hide fields based on linked combo box

I have one table, let's call it "leagues". Is this table, the fields are simply the league name, and then about 15 other yes/no fields.
I then have a second table and related form. Lets call that "Games". The idea is that when the user selects any given league (which is a linked field to the first table), then I want only certain fields to show up based on the yes/no criteria.
I've found two other posts that offer some ideas, but I don't quite see my exact situation.
Hide Controls in MS Access Based on Value Field
and
Ms Access Hide and Show Fields based on combo box choice
In addition, All those other fields that may or may not be visible are all linked fields to a third table called "members". I want to ensure that when a certain member is selected in any given field, they cannot be selected in any other field for the current record. I can use validation rules on each control, but I feel there is an easier way.
Please, steer me in the right direction, and if you can offer sample code, that would help.

how to create a filter form for a Microsoft Access Report

I am fairly new to Access. I am trying to create a filter pre-report form. On this form, the user will be asked for a start and end date. He will also be given a list of Item names which are found in a different form/table and will have the ability to check off which items the report should filter on.
Do I need to use a subform for this? I tried one out, but I can't see how to add checkboxes, it seems to just give me a list and I can't modify the subform.
What I really think I need to do is to populate a checkbox list with all of the items in the other table. How exactly would I do this (if its really the best solution)?
You can use a regular form for this. You do not need to bind it to a table. Just drop 2 textboxes on the form, and as many checkboxes as you feel you need.
The report will be based on a query, which in turn will be based on this form. All the fields will be brought into the query and will reference the controls on the form.
For instance, let's say you have 2 textboxes on the form; one called txtStartDate and one called txtEndDate. The form will be called frmReportFilter. In the query that's driving the report, pull in your date column and in the Criteria put >=Forms!frmReportFilter!txtStartDate. This will pull in all records where your date field is greater than or equal to whatever is in the Start Date textbox. The rest will be referenced similarly.

Refresh MS Access Form/Query Based On Combobox Value

Pretty simple explanation. I have a table with 10 entries, 5 entries with the year 2010 and 5 entries with 2011 in a column.
In the query I have, I use Like *2010 to filter out all entries equal 2010 and display onl those records.
On my form, I have combobox being populated with each unique year (from a different table). So my combobox values are 2010 and 2011.
Is it possible, when I select say 2011, I trim the right 4 characters and use as my Like criteria to refresh and requery the form, all done within VBA?
You can refer to the value of a control in a query run from within an Access session, as long as the form which contains that control is open.
SELECT *
FROM YourTable
WHERE date_field_as_text Like "*" & Forms!YourForm!YourCombo;
So perhaps you can use a similar query as your form's record source, and do Me.Requery in the combo box's after update event.
If that's not close enough to what you want, please give us more information about the data types of the fields involved. Adding brief samples of the table data to your question could also help; please make it clear whether the "date" fields are text or Date/Time.
Yes, it's possible.Just add your stuff to the 'YourComboName.After_Update'.
Look for the Events of the Form that are fired before the form is shown. There build your query as like HansUp suggested.

Access: Multi-value field

I am trying to design a form where the user can search records to filter a report. The user must be able to select many values from a particular field (multivalued field). I understand I can use a list box, but the field has a total of 3,000 records and cycling through is too much. I just want to know what other ways I can let the user insert multiple values?
I have these ideas, but maybe you guys have another better way:
Creating multiple combo boxes and keep them hidden until the user hits an “add” button, but this limits me to the amount of values I can have. If I have 10 hidden combo boxes I can only enter a total of 11 (10 hidden plus the original visible) values.
Is it possible to have a temporary data grid where the user just enters the values.
Then comes the problem of getting this into the SQL Record Source. I am thinking of the SQL IN clause.
Any help or ideas, will be greatly appreciated.
I think that you should create Comboboxes where values from next combo are dynamically populated when value in previous Combo has been changed so that way you can create hierarchy of values to select.
I've done something similar for a few different applications in slightly different ways. Basically, I present the user with a table, allow them to right-click > filter (the same could be accomplished by providing a filter textbox for each corresponding field in the table you want to allow filtering on... in your case it sounds like you only need one). The filter box allows them to use 'and' and 'or' along with the actual text of what they're looking for. Then they click a button that opens the report and fills the report's filter field with whatever filter they had applied.
Of course, this assumes the user is familiar with the data they're filtering, and requires a bit of training, but for me it was a simpler alternative than displaying a list with a bajillion entries in it. Your mileage of course may vary :)

Getting the difference between two counts in Microsoft Access Report

I have a report which lists 2 fields namely appointments and absences. Now what I want is that after building the report, I want to get the difference between these 2 counts. Is that possible?
thanks!
If your report has two fields on it, Appointments and Absences, and they are named the same, create an unbound control and assign its ControlSource to be this:
=[Appointments]-[Absences]
Now, I wouldn't really recommend using that, since it's likely that the controls and the fields they are bound to have the same name. I'd rename the control that is bound to Appointments as txtAppointments and the one bound to Absences as txtAbsences, and the calculation would then be [txtAppointments]-[txtAbsences].
Now, keep in mind that this assumes that neither field is ever Null. If it is, you probably want this, instead:
=Nz([txtAppointments], 0)-Nz([txtAbsences], 0)
Try and see if it works!