I have an Access form with a text box named Box1.
In this text box, I want to have the name of the last product in my table Products as the default value.
My table product has the fields: P_ID and P_Name.
I have coded in VBA in the form:
Me!Box1.DefaultValue = DLookup("P_Name", "Products", "P_ID = DMax("P_ID", "Products")")
However, there is an error in my code as the textbox displays #Name.