I have a from with 4 textboxes and a cmd button on it:
TextHex0
TextHex1
TextEng0
TextEng1
I want to use the 4 boxes as input from the user to make a calculation. All the textboxes need to have a value and the TextEng(x) must be numeric.
This is where I stand so far:
Private Sub cmdCalculate_Click()
Dim iLoop As Integer
Dim iNumOfSamples As Integer
Dim strMessage As String
Dim varEng As Variant
strMessage = "You must have a minimum of 2 values, "
strMessage = strMessage & "in the positions 1 and 2 " & Chr(13) & Chr(10)
strMessage = strMessage & " for both HEX and ENGINEERING"
'Make sure you have a minimum of two values for each HEX and ENGINEERING
For iLoop = 0 To 1
If (Me.Controls("Texthex" & iLoop).Value = "" Or Me.Controls("TextEng" & iLoop).Value = "") Then
MsgBox strMessage, vbOKOnly, "Input Values"
Exit Sub
End If
iNumOfSamples = iNumOfSamples + 1
Next iLoop
'Make sure the engineering values are numbers
For iLoop = 0 To iNumOfSamples - 1
varEng = Me.Controls("TextEng" & iLoop).Value
If (Not IsNumeric(varEng)) Then
MsgBox "Engineering values must be numeric", vbOKOnly, "Input values"
Exit Sub
End If
Next iLoop
End Sub
The problem that I have is that the first part produce no result if I have a blank textbox, but the second part work fine, if you type a letter in one of the TextENG() textbox the error message apear.
Idealy if I have any blank the top strMessage should popup.
Any idea will be welcome.