Saving data

A

azu_daioh

I have a table [Claimant] with controls [SSN], [FirstName], [LastName]

I have 2 forms [ClaimantDetails] and [ClaimDetails]

The control [ClaimDetails]![SSN] has an afterUpdate event to check if
the table [Claimant] contains the same [SSN] if it does, it updates
certain controls in [ClaimDetails]. If the SSN is not found in
[Claimant] table, it opens another form [ClaimantDetails] to create a
new record the the new SSN. After I complete the [FirstName] and
[LastName] controls in [ClaimantDetails], I want it to update the
information in [ClaimDetails] but I keep getting the error "The
Microsoft Jet database engine cannot find a record in the table <name>
with key matching field(s) <name>. (Error 3101)"

I know what causes but I cant figure out how to solve it. I tried
DoCmd.Save acForm "ClaimantDetails" before closing it so that it will
update the [Claimant] table. But the recordsource in my half-
completed [ClaimDetails] form does not recognize the new claimant's
SSN is already in the [Claimant] table.

How do I fix this problem? Any help is appreciated.

Thanks,

Sharon
 
K

Klatuu

two things
DoCmd.Save acForm "ClaimantDetails"
does not save the data, it saves the current design of the form. For
example, while you had the form open, you changed the Filter property, it
would save the form with the filter property as you set it.

When you close ClaimantDetails, it autmatically adds the new record to the
table. The problem is, the ClaimDetails form doesn't know it. For the new
record to be included in ClaimDetails Recordset, you have to requery the
form. Exactly where that needs to be done, I can't say, because I don't know
enough about the interaction between the two forms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top