Hello all. I have a form in access '97 that opens another form in datasheet view. These forms are related by a field called "RecordNo". This is the code I use:
This works fine when the form is first opened but when more than one record is to be added the record number defaults to 0 or is left as Null. I don't want the user to have to manually enter the RecordNo for each invoice number he adds to the datasheet. How can I automate this?
Thanks in advance,
Jason
Code:
Private Sub cmdInvoices_Click()
Dim stcrit As String
stcrit = "RecordNo = " & Me!txtRecordNo.Value
Debug.Print stcrit
DoCmd.OpenForm "sbfrmInvoiceER", acFormDS, , stcrit
Forms![sbfrmInvoiceER]![txtRecordNo] = Me.txtRecordNo
Forms![sbfrmInvoiceER].Caption = "Record " & Me.txtRecordNo & " Invioces"
End Sub
This works fine when the form is first opened but when more than one record is to be added the record number defaults to 0 or is left as Null. I don't want the user to have to manually enter the RecordNo for each invoice number he adds to the datasheet. How can I automate this?
Thanks in advance,
Jason