Please tell me what is wrong with the following code and how can i best accomplish the following.
I a created a module (NextNum) with the 3 functions. I want to call these functions in 3 different forms. My goal is (1) to get the next available autonumber, (2)Convert that from Long to Text, (3) Display the Value in a textbox located in a form. "Your next available number is:"
Code in NextNum module:
Option Compare Database
Dim WNum As Long
Dim ENum As Long
Dim GNum As Long
Public Function NextW()
WNum = Nz(DMax("[WLogNo]", "stLogW"), 0) + 1
End Function
Public Function NextE()
ENum = Nz(DMax("[ELogNo]", "stLogE"), 0) + 1
End Function
Public Function NextG()
GNum = Nz(DMax("[GLogNo]", "stLogG"), 0) + 1
End Function
********************************
In one of my forms I have the following code:
Dim AvailW As String
Dim UW As String
Private Sub Command0_Click()
Call NextW
AvailW = CStr(NextWSJV)
WText.txt = AvailW
End Sub
When I click the button I get the following message:
"Member already exist in an object module form which this object module derives."
Please help. I just starting to learn using functions but I have to make this work ASAP.
Thanks in advance
I a created a module (NextNum) with the 3 functions. I want to call these functions in 3 different forms. My goal is (1) to get the next available autonumber, (2)Convert that from Long to Text, (3) Display the Value in a textbox located in a form. "Your next available number is:"
Code in NextNum module:
Option Compare Database
Dim WNum As Long
Dim ENum As Long
Dim GNum As Long
Public Function NextW()
WNum = Nz(DMax("[WLogNo]", "stLogW"), 0) + 1
End Function
Public Function NextE()
ENum = Nz(DMax("[ELogNo]", "stLogE"), 0) + 1
End Function
Public Function NextG()
GNum = Nz(DMax("[GLogNo]", "stLogG"), 0) + 1
End Function
********************************
In one of my forms I have the following code:
Dim AvailW As String
Dim UW As String
Private Sub Command0_Click()
Call NextW
AvailW = CStr(NextWSJV)
WText.txt = AvailW
End Sub
When I click the button I get the following message:
"Member already exist in an object module form which this object module derives."
Please help. I just starting to learn using functions but I have to make this work ASAP.
Thanks in advance