Update Index Method in Subform

J

Jaybird

I have a form with several subforms on it. Because the table relationships
are required to be a certain way, I have had to code in a method for synching
the records via the form. The code is below:

Private Sub Form_Current()
Dim Response As Variant
On Error Resume Next

If IsNull(Me.INVNUM) Then
Me.INVNUM = Format(DMax("Left([INVNUM],5)", "HDRPLAT") + 1, "00000") & "A"
Response = MsgBox("Is this Invoice Number what you want?", vbOKCancel)
If Response = vbCancel Then
Me.Undo
Exit Sub
End If
Response = acDataErrContinue
Me.Parent.InvoiceNumber = INVNUM
End If

End Sub

It works fine at creating indexes that are in synch with existing records,
but it fails to provide a method for canceling the operation. The Me.Undo
method I'm using now creates empty strings where the indexes should go. So,
if that method doesn't work reliably, does anyone have any suggestions for a
different technique?
 

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

Top