Minggu, 13 Desember 2015

RE: [MS_AccessPros] Re: Auto Invoice Number

 

Gina,

 

I have read over the page you referenced.  I thought I understood it but I am getting an error.

 

 

Just like the instructions said, In the From property Before Update I put this code.

 

Private Sub Form_BeforeUpdate(Cancel As Integer)

           If Me.NewRecord Then

Me.IncNumber = Nz(DMax("IncNumber", "t_Invoices"), 0) + 1

 End If

End Sub

 

It will not fire.  The field on the form stays blank.   Me.IncNumber is referring to the field on the form that holds the Invoice Number.

 

 

 

When I changed the code to more closely represent what was on the web site, see below

 

Private Sub Form_BeforeUpdate(Cancel As Integer)

           If Me.NewRecord Then

Nz(DMax("IncNumber", "t_Invoices"), 0) + 1

 End If

End Sub

 

I get an error message, the line turns red and the curser hovers over the "+".

 

The error messages says  Compile Error: Expected =

 

Which is why I tried the top example.

 

Any help you, or anyone, could provide would be greatly appreciated.

 

Thanks,

Bill

MN

With rain in December, which is Awsome.

 

 

 

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Saturday, December 12, 2015 7:00 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Auto Invoice Number

 

 

Use DMax(), have a look at...

http://regina-whipp.com/blog/?p=704 

__._,_.___

Posted by: "Bill Singer" <Bill.Singer@at-group.net>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar