Gina,
Yes, the user will have to put in more information. That was part of my testing error. I was not completing the invoice. I was hoping the invoice number would show up right away but it does not until the record is saved or I move to a subform. This will work OK. I am just going to change the field so no one tries to manually fill it in.
I checked the table and the records are saving with the correct numbers in them.
If you have any thought that may enhance the code let me know.
Have a good night.
Bill
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Sunday, December 13, 2015 7:33 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Re: Auto Invoice Number
I just realized what you are doing… but I see you got it working (had to eat my dinner). In any event where are you putting the save and why are you putting the save? You have created the record… doesn't anyone have to enter additional information?
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 8:16 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Re: Auto Invoice Number
Gina,
I worked with the code behind a button to guarantee it fired.
Once I got it to work I moved it to the Before Update.
Now it works but it does not show up until after the record saves. That is OK. I took the auto save out of the code because it was causing an error. For now it works good enough. I will keep trying to get the auto save to work as well.
Thanks for all your help.
Bill
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Sunday, December 13, 2015 6:23 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Re: Auto Invoice Number
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]
[Non-text portions of this message have been removed]
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 (8) |
Tidak ada komentar:
Posting Komentar