Hello,
I am trying to put functions into modules now. I have little experiece with this since I have always placed them directly in the forms. But I'm trying to get more organized, plus (and maybe more importantly) learn VBA more. I have this code in a module called: Number_System
Code:
Me.Unique_Number = Format(Nz(DMax("[DAA-MasterTable].Unique_Number", "DAA-MasterTable", "Standard_Number = '" & Me.Standard_Number & "' AND FY = '" & Me.FY & "'"), 0) + 1, "0000")
DoCmd.GoToControl "Employee_Name"
I call it via a button in the form by:
Call Number_System.GenerateNumber(Me)
Everytime I press the button it states; "Invalid Use Of ME Keyword"
Not 100% sure why it's doing this. I took a stab in the dark and removed all of the "Me." from the module and that did not work.
Thanks,
---roystreet
Also, I don't know if this makes a difference in this case, but would I use public function or public sub in the module?? Currently, I'm using public function.
I am trying to put functions into modules now. I have little experiece with this since I have always placed them directly in the forms. But I'm trying to get more organized, plus (and maybe more importantly) learn VBA more. I have this code in a module called: Number_System
Code:
Me.Unique_Number = Format(Nz(DMax("[DAA-MasterTable].Unique_Number", "DAA-MasterTable", "Standard_Number = '" & Me.Standard_Number & "' AND FY = '" & Me.FY & "'"), 0) + 1, "0000")
DoCmd.GoToControl "Employee_Name"
I call it via a button in the form by:
Call Number_System.GenerateNumber(Me)
Everytime I press the button it states; "Invalid Use Of ME Keyword"
Not 100% sure why it's doing this. I took a stab in the dark and removed all of the "Me." from the module and that did not work.
Thanks,
---roystreet
Also, I don't know if this makes a difference in this case, but would I use public function or public sub in the module?? Currently, I'm using public function.
Last edited: