There has got to be a simple(r) way to do this.
I have a situation where I am listing parts using continuous forms. The parts listing has things like the part type, manufacturer, part number and the quantity. The list is of the part instances & quantity. I can look the other things up from the instance of the part, so displaying existing parts is no problem, just use a joined query to retrieve the related records or using a DLookup to pull the fields individually.
Type Manufacturer Number Qty
-------------------------------------
Widget Acme 123ab 1
Widget Acme 456 1
Anvil Xyz 12345 2
Llama Northwind 322-12A 1
...
The problem is where the users need to add new parts. There are thousands of different parts, so they can't really choose from a single part number combobox. They want to be able select a part type, manufacturer, and then the part number from three different comboboxes that successively narrow the results in each combobox.
Select a part type >> select a manufacturer who makes one of those types >> select part number of parts of that type by that manufacturer >> enter quantity
Ok, so I can use 2 unbound comboboxes with a DLookup as default, and link them via their Row Source queries. The final combobox is part number with its Row Source filtered - so it only lists the parts from selected type and manufacturer. I have done that before with this kind of situation and it works well.
However I am trying to do this with continuous forms in Access and it is returning the same result for the Dlookup on each record. E.g.
Type Manufacturer Number Qty
-------------------------------------
Widget Acme 123ab 1
Widget Acme 456 1
Widget Acme 12345 2
Widget Acme 322-12A 1
...
Argh, what's going on? My Dlookups seem to be only using the value from the first record. Why?
Is this even a good way to do this? Is there a better pattern to use than drill-down comboboxes on the continuous form? The only other way I can think of to get around this is to use the comboboxes on a "add/edit part" type form where the details are selected in a dialog and then the part number is populated from that. But that seems even more kludgy.
Using unbound controls on a continuous form will only drive you demented, because an unbound control can only refer to the selected record, which could be any of them. I think the pop-up form for adding new records would be quite nice, and easy for the user to understand.
Related
I have a table tblSupplierCriteria. I can populate it from a form that consists of the Supplier Name followed by a dropdown box that lists 46 criteria.
The user selects one of the criteria and then clicks on save. In the table, the saved record looks like - Supplier1 nuts, the next record looks like Supplier1 bolts and so on.
Each Supplier can have between 1 and 46 records. Each is added one at a time. The form works fine but it is tedious. Is there a way that I can display all 46 items at one time and let the user choose by clicking a check box or something and then populate the SupplierCriteria table as described above?
This is part of a highly integrated application and I cannot modify any of the table structures.
In general, if you can display the criteria in a dropdown box, you can display them all in a pop-up form so someone can tick them off.
If you can create a local table, you can copy the 46 criteria from the central data to the local table, and add a Yes/No column so you can record what the user picks.
Base your pop-up form off of the local table. Populate SupplierCriteria based on their choices.
I have an Access table "Contacts" that looks like this:
Contact Extension
Bill Mann 7283
Jim Bob 2563
Sue Zan 5963
etc...
I have another table "Departments" that looks like this:
Department Description
0040 Fun station
0110 Happy town
0110C Happy town with clowns
etc...
I have created a form that pulls in data from Contacts as well as Departments to make some assignments:
What I would like to do is automatically populate this form upon opening, with the latest assignments that were made by the form. Then these assignments can be changed and saved at will. To me this seems to mean that the combobox will be assigned a default value from a table that is distinct from the Contacts and Departments tables. The problem I am running into is that I can't seem to find a way to assign those default values and allow all of the possible choices from Contacts and Departments.
I am happy to use a VBA solution if necessary.
It seems you need a third table to save the "Packaging Materials Assignments" and that the form should be bound to that table.
Then you set each of the fields on the form from each of the comboBoxes. Then save the record and your current assignments are saved.
When you open the form, you see the way the assignments were most recently set. Then you can change the assignments if needed.
I might be convenient if you set the form's Property.Cycle = "Current Record". That way there will only ever be one record in the third table. Also after creating your one record, set "Allow Additions" and "Allow Deletions" to be false for the 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.
I have a simple combobox in Access which serves as a result set holder and contains two columns id and name.
I have developed a simple search feature,
i.e user types in a keyword in a textbox and the combobox returns the results after searching the substring,
Example:
TXT BOX Input: App
Combobox Results:
ID Name
1 Cinnamon Apple
2 Apple Candy Box
42 Carton of Apples
54 iphone App
6 App Store
Now when I go to search the combobox box within the results and I type "i", I expect to select "iphone App" from the drop down but nothing happens because it is searching the first column i.e ID
So how can I search for the names and autocomplete the combobox? or search by second column
Also, It is important for me to show the ID, If I hide the ID column I can search by the Name just fine, since it is the only column in the result set.
Hiding the ID is the simplest way of accomplishing what you want, but I recognize that you said you don't want to hide the ID field.
I think it is possible to do what you want. Basically, on every keypress you will need to reset the RowSource for the combobox to be filtered down to only items that match the users keypress. In my experience, this works best in dropdown menus that you are using for filtering, as opposed to dropdowns used for data entry, especially if you are using a continuous or datasheet form. There are a lot of gotchas and caveats you'll run into when doing this. I can't really recommend attempting this unless you are an experienced VBA programmer. My own implementation uses quite a number of events to make it work including Enter, KeyUp, KeyDown, KeyPress, and AfterUpdate. I also use a timer so that I can accumulate their keypresses and only change the rowsource after some 300ms of no keypresses. I also use ADO with a Disconnected Recordset so that I can filter the recordset without making calls to the database again (in the name of efficiency and "keeping the wire cool").
If you want some code, I did post a very basic version of this early in my development of the idea over at UtterAccess. I think it's probably going to be buggy and it might not work properly with you wanting to show the ID field. That is something that I had to make work properly on one of my projects since I originally posted my code.
http://www.utteraccess.com/forum/Autocomplete-Autosugges-t1986007.html
The Workaround is to show Name and then ID in the Combobox, So when I start typing in the Combobox , it Autocompletes Name by Default instead of ID.
I am new to Access programming and am trying to determine the correct way to bind unbound textbox controls for each row in a continuous form.
As an example:
Continuous Form to display a list of invoices from an Invoice table.
Table called InvoiceItems which contains equipment, rates and hours.
I need to have a form that has a row containing invoices with a column for all available equipment types.
I was planning on having unbound textboxes for each equipment type and then when each Invoice row is loaded, hook into something like an OnRowDataBound where I could dynamically populates the equipment textboxes with the appropriate data from the InvoiceItems table.
Example:
Tables:
Invoice: InvoiceID, Date
[1, 4/10/2011]
InvoiceItems: EquipmentID, Rate, Hours
[2, 40, 1]
[3, 20, 3]
Result:
InvoiceID | Date | Shovel | Plow | DumpTruck
==================================================
1 5/10/2011 3 1 0
2 2/11/2011 1 0 1
Then each textbox control would hook into the onDirty event to update the appropriate InvoiceItem line item.
You won't be able to do this in a continuous form or a datasheet view form since changing the ControlSource property on one row affects all rows.
It's unclear to my why you would even need this option but it sounds like your data/tables might not be designed properly or properly normalized. Usually I would build my tables so that EquipType is a value you can change to show what type of equipment this row is. It appears that somehow you are using different fields for each different equipment type.
Assuming that you insist on using your current design, you could possibly cobble together a solution using Union queries but your recordset will not be updateable.
Another suggestion is to make several different textboxes on your form and change the visible property on the fly. However, this is fraught with problems because you will only be showing one of them at a time on all rows. Furthermore, you'll have to show the correct one when they move to the next record but how are you going to determine which is the correct one to show?
Judging by what you've written, you must have experience programming in .Net. Access is a different beast and it works quite well if you play by its rules. Trying to get around some standard Access behavior or design will usually result in frustration for both the programmer and the user. I think this is a case where you will need to evaluate what you're trying to do and I recommend you start by making sure your table architecture is solid. Perhaps you've actually over-normalized and will need to go back and undo some of your normalization.