Using Access 2000
When a command button on a form is pressed, a Project is changed from a Quote to Invoice Details, the Project is marked as "Quote Accepted," and data in a subform copied (duplicated in the same table) but the duplicated data marked "Invoice" (a Yes/No field). I want then to show the Invoice data rather than the Quote data, so need to update the form so that the Invoice data (Invoice=Yes) shows and not the Quote data (Invoice=No).
I also need to test to be see (1)whether or not there is more than one record, and (2)whether or not we are on the last record.
Following is the code behind the command button to accomplish this.
Is this an acceptable method, or is there a better way?
I initially thought that RecClone.MovePrevious and RecClone.MoveNext would work, but they don't.
Tom
When a command button on a form is pressed, a Project is changed from a Quote to Invoice Details, the Project is marked as "Quote Accepted," and data in a subform copied (duplicated in the same table) but the duplicated data marked "Invoice" (a Yes/No field). I want then to show the Invoice data rather than the Quote data, so need to update the form so that the Invoice data (Invoice=Yes) shows and not the Quote data (Invoice=No).
I also need to test to be see (1)whether or not there is more than one record, and (2)whether or not we are on the last record.
Following is the code behind the command button to accomplish this.
Code:
Dim recClone As DAO.Recordset
Set recClone = Me.RecordsetClone
If recClone.RecordCount > 1 Then
If recClone.EOF Then
DoCmd.GoToRecord , , acPrevious
DoCmd.GoToRecord , , acNext
Else
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acPrevious
End If
ElseIf recClone.RecordCount = 1 Then
DoCmd.GoToRecord , , acNewRec
DoCmd.GoToRecord , , acPrevious
End If
recClone.Close
Set recClone = Nothing
Is this an acceptable method, or is there a better way?
I initially thought that RecClone.MovePrevious and RecClone.MoveNext would work, but they don't.
Tom