jmbcreative
Technical User
Howdy Folks,
I have a bit of a complication with the DMAX sequence that I am running. To give you the rundown, basically I have a table that maintains equipment inventory "HardwareList copy". This table identifies a main system and all of it's components. The are identified with controlID's that go somewhat like
112,
112a,
112b,
113,
113a
..and so on. The plain numbers are the main systems and the numbers with a letter at the end are ethe cooresponding components. I have created a seperate table to hold the new hardware add requests. I have a form to do this to make it easier on the requestor. I created a macro to run when the form loades that asks if the requestor qishes to add a component or a system. If the requestor selects to add a new system, the macro looks at the last controlID in the main hardware inventory and the request table, "HardwareAdd Query", and is supposed to auto incriment and add this number to the field in the hardware add form. This works fine if the last controlID in the hardware inventory is a plain number, but when the last controlID is number witha letter at the end I recieve a "type mismatch error" on load of the form. Does any one know the best way to remedy this so the macro will ingore the letter in the hardware inventory?
Below is the sntax that I am using for this:
_______________________________________________
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim reqMsg As Integer
reqMsg = MsgBox("Add New System: Press YES, ADD Component: Press NO", vbYesNoCancel + vbExclamation, "Test Message")
If reqMsg = 6 Then
Dim strMax2
strMax2 = IIf(DMax("[ControlID]", "[HardwareList Copy]") > DMax("[ControlID]", "[HardwareAdd Query]"), 1 + DMax("[ControlID]", "[HardwareList Copy]"), 1 + DMax("[ControlID]", "[HardwareAdd Query]"))
Me.ControlID = CStr(Val(strMax2))
________________________________________
I've been banging my head on this one. Any ideas?
I have a bit of a complication with the DMAX sequence that I am running. To give you the rundown, basically I have a table that maintains equipment inventory "HardwareList copy". This table identifies a main system and all of it's components. The are identified with controlID's that go somewhat like
112,
112a,
112b,
113,
113a
..and so on. The plain numbers are the main systems and the numbers with a letter at the end are ethe cooresponding components. I have created a seperate table to hold the new hardware add requests. I have a form to do this to make it easier on the requestor. I created a macro to run when the form loades that asks if the requestor qishes to add a component or a system. If the requestor selects to add a new system, the macro looks at the last controlID in the main hardware inventory and the request table, "HardwareAdd Query", and is supposed to auto incriment and add this number to the field in the hardware add form. This works fine if the last controlID in the hardware inventory is a plain number, but when the last controlID is number witha letter at the end I recieve a "type mismatch error" on load of the form. Does any one know the best way to remedy this so the macro will ingore the letter in the hardware inventory?
Below is the sntax that I am using for this:
_______________________________________________
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim reqMsg As Integer
reqMsg = MsgBox("Add New System: Press YES, ADD Component: Press NO", vbYesNoCancel + vbExclamation, "Test Message")
If reqMsg = 6 Then
Dim strMax2
strMax2 = IIf(DMax("[ControlID]", "[HardwareList Copy]") > DMax("[ControlID]", "[HardwareAdd Query]"), 1 + DMax("[ControlID]", "[HardwareList Copy]"), 1 + DMax("[ControlID]", "[HardwareAdd Query]"))
Me.ControlID = CStr(Val(strMax2))
________________________________________
I've been banging my head on this one. Any ideas?