Hello,
I stole some code from another Access DB that I manage (well...attempt to manage anyhow)
The code uses DMax to assist with generating a unique audit number with the last two digits of the current year as a prefix.
I am trying to adapt this code to an order entry system, and same thing, just want a unique order number.
Here is the string that is causing me the issues:
Me.txtSequence = Nz(DMax("[Sequence]", "TblOrders", "Year([OrderDate]) = " & Year(Me.OrderDate)), 0) + 1
When I compile, the portion in blue is highlighted, and the message "Method or data member not found."
OrderDate is a valid field in the DB.
Here is the code I swiped from my other DB:
Me.txtSequence = Nz(DMax("[Sequence]", "audlog", "Year([MAAssignDat]) = " & Year(Me.MAAssignDat)), 0) + 1
There is a "Me.Dirty=False" statement following the line of code (in both instances)
If I take out the Me. and simply leave OrderDate, the form prompts me to enter the Order Date manually (there is a date picker entry box on the form for the order date) then when I press the Generate Order # radio button on the form, the field Order # is populated with the Order Date (long date)
Original DB was created in Access 2007
New DB is Access 2010
Any help will be greatly appreciated!
John
I stole some code from another Access DB that I manage (well...attempt to manage anyhow)
The code uses DMax to assist with generating a unique audit number with the last two digits of the current year as a prefix.
I am trying to adapt this code to an order entry system, and same thing, just want a unique order number.
Here is the string that is causing me the issues:
Me.txtSequence = Nz(DMax("[Sequence]", "TblOrders", "Year([OrderDate]) = " & Year(Me.OrderDate)), 0) + 1
When I compile, the portion in blue is highlighted, and the message "Method or data member not found."
OrderDate is a valid field in the DB.
Here is the code I swiped from my other DB:
Me.txtSequence = Nz(DMax("[Sequence]", "audlog", "Year([MAAssignDat]) = " & Year(Me.MAAssignDat)), 0) + 1
There is a "Me.Dirty=False" statement following the line of code (in both instances)
If I take out the Me. and simply leave OrderDate, the form prompts me to enter the Order Date manually (there is a date picker entry box on the form for the order date) then when I press the Generate Order # radio button on the form, the field Order # is populated with the Order Date (long date)
Original DB was created in Access 2007
New DB is Access 2010
Any help will be greatly appreciated!
John