John,
Good tip… only that copy/paste was from my blog. One day, I will finish going thru and fixing all of those… in the beginning I wasn't paying attention to that. L
Gina Whipp
Microsoft MVP (Access)
<http://www.access-diva.com/> access-diva
Specializing in Microsoft© Access® Solutions
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Monday, December 14, 2015 4:59 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Auto Invoice Number
Gina-
Because I write code samples a lot, I've turned off "smart quotes" in my mail program. 😃
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
On Dec 14, 2015, at 1:23 AM, gina@access-diva.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Did you copy/paste? If yes, then retype the quotations marks.
Gina Whipp
Microsoft MVP (Access)
<http://www.access-diva.com/> access-diva
Specializing in Microsoft© Access® Solutions
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Sunday, December 13, 2015 6:59 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: 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
[Non-text portions of this message have been removed]
------------------------------------
Posted by: <gina@access-diva.com>
------------------------------------
------------------------------------
Yahoo Groups Links
[Non-text portions of this message have been removed]
Posted by: <gina@access-diva.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (11) |
Tidak ada komentar:
Posting Komentar