If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Saving data
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 |
#2
|
|||
|
|||
Saving data
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. -- Dave Hargis, Microsoft Access MVP " wrote: 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 |
Thread Tools | |
Display Modes | |
|
|