The ResultAB filed, yes I was aware that storing calculated numbers should not be done as the numbers could change but the calculation would not update. Hi, yes, on my actual project database the partnumber field is unique, I did not make it unique for this test. SubFormTest3.odb (31.85 KiB) Downloaded 161 times In this listbox you can test if a PartNo already exists. I added a tall listbox with no field binding. ![]() If you enter a not existing PartNumber, the subform remains blank and you can enter a new record. It offers auto-complete through a combo box. See countless forum topics on "power filtering" and the form properties. The second form makes use of the "power filtering" technique which requires an additional filter table. Then you can pick (or type) a value and finish filter mode by clicking the first button on the temporary filter mode toolbar. With property "Filter Proposal" the text box turns into a list box when you turn on filter mode. The first form can look up a record by using the built-in form filter. I added a query which is used as data source of the first and second form. I removed all auto-ID from the input forms. Calculated values are calculated in queries according to stored values but you never store calculation results. You must not store any calculated values in tables. I removed the ResultAB field from table Main. You could also use that field as a "natural" primary key but the auto-ID does its job. ![]() I added a unique index on the PartNumber, so it is enforced to be unique. From screenshot it is very hard to tell what is happening. HOWEVER, the error message describes an UPDATE statement whereas the insertion of a new record would be an INSERTion. Same with any other unique index.īut then you should restrict the form to now allow new records because the slave field will inherit its value from its master field, so you are going to create a duplicate record.Ī subform for new records only makes no sense when its given master values pass over existing primary key values. If you filter a subform by primary keys, the subform is always populated by one record since the primary key is unique by definition. ![]() The subform is filtered by the given values, so it includes only those records where the slave fields match their corresponding master fields.Īny slave field in a new subform record inherits its value from its master field. Slave fields can also be the names of parameters, so you substitute parameters with the corresponding fields of the parent form. ![]() The corresponding fields are set up as master and slave fields in the subform's data properties. I have checked the form and it has allow modifications.Ī subform is filtered by the corresponding values of its parent form. So its trying to add a new record but i am wanting to modify. However when i make a change and press save I am getting an error as its trying to add a duplicate PartNumberID. I managed to so far make the listbox show all harnesses (will add the customer filter once i get this bit working) and once i choose a harness the PartNumberID is correctly also chosen. SO for this I would like to change the existing PartNumber field to a listbox that will list the parts in the system but filtered against the customer. Once this is entered into the database it will then be picked up by another employee who will then add other details such as cost, time and size Etc.įor the second form lets call it PartNumberAdd I have simply copied the initial form, deleted details not relevant and added new fields which will be updated and the record saved. The form only has basic information such as part number, description and customer. So I have a basic form which is working ok for adding new records.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |