Home > database >  A novice for help: how to parent form button to add records to the child form?
A novice for help: how to parent form button to add records to the child form?

Time:09-16

There are goods information table (the parent table) and goods for the record (a table), two tables by item number connection (one-to-many relationship), and create a nested forms,

Want to achieve is: in the parent form, set up the two buttons, one is the "outbound" button, the other is a "library" button, click later, input the number, you can add a new record in the child form, automatic filling outbound/inbound, quantity and time fields, such as

What button code in how to write?

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Just contact access soon, request elder support

Use the access version is 2016,

CodePudding user response:

Figure had better, otherwise can only say that the overall train of thought is whether you are inbound or outbound, you need to update the parent table, make the choice of quantity of the goods number in the parent table updates (outbound is reduced, warehousing is to add), at the same time you will go to in the child table increased outbound records or the storage of the items in the record, these operations had better be to use transaction for, guarantee the synchronous operation, code, does not use VBA code executing SQL statements in the Access process, this method has a lot of, can be called docmd. RunSql method, can be called currentdb. The execute method, you can call currentproject. Connection. The execute method,
  • Related