Using DMax to create invoice numbers with letters in them (1 Viewer)

Metric

Registered User.
Local time
Today, 00:00
Joined
Sep 14, 2019
Messages
26
Hello,


I am creating a form that contains a series of invoices. I have created a command button that inserts the next number in a series as the invoice number - this is the code I used as "On Click"


If Me.NewRecord = True Then
Me.Invoice = Nz(DMax("Invoice", "Invoices"), 0) + 1
End If


This works great! However, the invoices actually need to be named a combo of letters and number, i.e. XXX1, XXX2, XXX3 and so on. The letters never change. Can I concatenate it somehow so that the entry on the form shows the actual invoice name and not just the number?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:00
Joined
Oct 29, 2018
Messages
21,467
Hi. If the letters don't change, you don't even need it in the table or record. Simply "format" the value with the letters added, for display purposes. But yes, you can also use concatenation.
 

Metric

Registered User.
Local time
Today, 00:00
Joined
Sep 14, 2019
Messages
26
Hi. If the letters don't change, you don't even need it in the table or record. Simply "format" the value with the letters added, for display purposes. But yes, you can also use concatenation.


I was thinking of this but I'm actually not sure how to format it so the letters show up. Right now, in the 'invoice' field on the form there is only a number. What would I insert to make this show the letters too?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:00
Joined
Oct 29, 2018
Messages
21,467
I was thinking of this but I'm actually not sure how to format it so the letters show up. Right now, in the 'invoice' field on the form there is only a number. What would I insert to make this show the letters too?
Try:
Code:
XXX0
In the Format property.
 

Users who are viewing this thread

Top Bottom