This is the [Close] Button Code..........Thanks Bob
Private Sub cmdClose_Click()
On Error GoTo Err_Command80_Click
If IsNull(Me.tbInvoiceDate) Then
Me!tbInvoiceDate = DateSerial(Year(Date), Month(Date) + 1, 1)
End If
If Len([cbOwnerName]) = 0 Then
MsgBox "Please Select The Horse Name From The List.",
vbApplicationModal + vbInformation + vbOKOnly, "Intellisoft"
Exit Sub
End If
If Len([cbGSTOptions]) = 0 Then
MsgBox "Please Select The GST Options From The List.",
vbApplicationModal + vbInformation + vbOKOnly, "Intellisoft"
Exit Sub
End If
If bModify = True Then
CurrentProject.Connection.Execute "DELETE * FROM
tblDailyCharge WHERE InvoiceID=" & tbInvoiceID.value
CurrentProject.Connection.Execute "DELETE * FROM
tblAdditionCharge WHERE InvoiceID=" & tbInvoiceID.value
bModify = False
End If
subSetValues
subSetInvoiceDetailsValues
recInvoice.Update
Set recInvoice = Nothing
Forms!frmModifyInvoiceClient!lstModify.Requery
DoCmd.Close acForm, Me.Name
Exit Sub
Exit_Command80_Click:
Exit Sub
Err_Command80_Click:
MsgBox Err.Description
Resume Exit_Command80_Click
End Sub
"Tom Wickerath" <AOS168b AT comcast DOT net> wrote in message
> Hi Bob,
>
> What do you get if you issue this command directly from the Immediate
> Window?
>
> ?Nz(DMax("InvoiceNo", "tblInvoice"), 0) + 1
>
> Open the Immediate Window by pressing the Control and G keys at the same
> time, ie. <Ctrl><G>.
>
> Also, are you sure that you haven't already saved the record at this point
> in time? If you have, then Me.NewRecord will evaluate to False. You might
> try
> inserting a break point, and single stepping through the code using the F8
> key.
>
>
> Tom Wickerath
> Microsoft Access MVP
> http://www.accessmvp.com/TWickerath/
> http://www.access.qbuilt.com/html/expert_contributors.html
> __________________________________________
>
> "Bob Vance" wrote:
>
>> When I open a new record I am not gettting the next number if I select "
>> If
>> fraSelectInvoiceNoType = 1 "
>> I am getting a zero , Thanks for any help.............Bob
>>
>> If Me.NewRecord = True Then
>> If fraSelectInvoiceNoType = 1 Then
>> recInvoice.Fields("InvoiceNo") = NextInvoiceNo
>> ElseIf fraSelectInvoiceNoType = 2 Then
>> recInvoice.Fields("InvoiceNo") = 0
>> End If
>> ------------------------------------------------
>> Function NextInvoiceNo() As Long
>> NextInvoiceNo = Nz(DMax("InvoiceNo", "tblInvoice"), 0) + 1
>> End Function
>>
>> --
>> Thanks in advance for any help with this......Bob
>> MS Access 2007 accdb
>> Windows XP Home Edition Ver 5.1 Service Pack 3 >> Stay informed about: New Record Problem