Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery and Save Record

Status
Not open for further replies.

LittleMan22

Technical User
Jun 24, 2001
46
CA
Here's the deal...
I have a main form (frmClients) with a command button that brings up a bunch of options the user can pick from. If the user picks the first one 'convert existing policy' it brings up another pop-up where they can enter data. When they close this pop-up they are given the choice as to whether or not the want to convert the existing policy and save the data. At that point if they choose 'yes' the policy data they have entered will be saved into a table and the value of the old policy will be set to 'CHANGE'. Here's the code that I have written on the onclose event procedure of this form:

Private Sub ConvertExit_Click()
Dim Response

Response = MsgBox("Do you want enter this data as a new policy?", vbYesNo)
If Response = vbYes Then
Forms!frmClients!subFormPolicies!cmbSTATUS = "CHANGE"
Convert "Trans" ' creates a new policy
DoCmd.Close
Else
DoCmd.Close
End If

End Sub

Once this form closes, the origional pop-up is still open (the one that gave the user the choice of what they want to do) and when this one is closed the recordset is requeried so that the form displayes the new policy that the user has just created.

However, there is a problem. When I try to change the origional policy's value to "CHANGE" (as per aformentioned code) and then attempt to requery the recordset I get the error message that the data has not been saved yet...

How can I get around this? Is there a way to write code that will save a specific form? I need a line I think right after I change the policies status to CHANGE...

Any ideas?

Ryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top