given that in the table --books
field--barcode
type is string
the default value is "n288826830 000"
I would like to make it autogenerate when I input new books via the form and not as a primary key
thus when I enter a book, the barcode should be
n288826830001, which has the ability +1 from the default value.
I have attempt to dmax the field in load as follows:
I got runtime level error 6, with chinese error message that I don't even know what is it.
I know that it should be a number before I can strand the last digit and add one,
how about add one to the text, how could this be done ?
thanks.
field--barcode
type is string
the default value is "n288826830 000"
I would like to make it autogenerate when I input new books via the form and not as a primary key
thus when I enter a book, the barcode should be
n288826830001, which has the ability +1 from the default value.
I have attempt to dmax the field in load as follows:
Code:
Private Sub Form_Open(Cancel As Integer) Dim strmax As Long strmax = DMax("Barcode", "books") + 1 Me.Barcode.Value = strmax End Sub
I know that it should be a number before I can strand the last digit and add one,
how about add one to the text, how could this be done ?
thanks.
Comment