[AccessD] Update primary key problem

Gustav Brock gustav at cactus.dk
Thu Nov 6 10:28:14 CST 2014


Hi Susan

Couln't you just set the default value for the animal key whenever the user selects an animal?
This will last as long as the form is open.

/gustav

-----Oprindelig meddelelse-----
Fra: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] På vegne af Susan Harkins
Sendt: 6. november 2014 13:50
Til: Access Developers discussion and problem solving
Emne: [AccessD] Update primary key problem

I'm using a list box in a form's header section to allow users to set the individual animal for inputting details about existing animals (not a form for entering new animals). The list box isn't bound.

After selecting the appropriate animal, the main form accept details about the existing animal. A Save command button and the macro behind it saves the details, using the animal primary key from the list box as a foreign key in the details table. That works fine.

I want to retain the value in the animal list box so the user can enter a second detail record for the same animal -- there can be several "types" of details.

Using the macro's action, GoToRecord (New), I can quickly reset the detail controls. However, doing so won't update the detail record's primary key value though -- the control for that field displays New. If I reselect the value in the list box, it updates, but I don't want the user to have to remember to do this.

I'm seriously considering dumping the Save macro so I gain back a little control over the process. I need to retain the list box value for the next detail record, and in doing so, reset the individual foreign key. Wondering about the easiest, most efficient way to do this.

Susan H. 



More information about the AccessD mailing list