Private Sub Command2_Click()
Dim F_Cnt As Integer
Dim Sto_Fr As String
Dim i, Flag
Start_F = Text1.Text
End_F = Text2.Text
NO_OF_FREQ = Val(Text3.Text)
Dim Count_R
Value = LowHiVal()
'MsgBox Val(Low_Val)'
'MsgBox Val(Hi_Val)'
If Start_F <> "" Or End_F <> "" Then
If Start_F < Val(Low_Val) Or End_F > Val(Hi_Val) Then
MsgBox "Value out of Range. Please Enter New Values"
Else
F_Cnt = 0
New_Check = Start_F
Do While F_Cnt <> NO_OF_FREQ
If Combo3.Text = "Simplex" Then
New_Check = New_Check + Val(0.025)
End If
If Combo3.Text = "Duplex" Then
New_Check = New_Check + Val(0.05)
End If
Sto_Fr = New_Check
'MsgBox New_Freq'
Place_Use = Combo9.Text
'Search the DB'
sqlExecuteVHFCheck
GoTo recordsetSql1
recordsetSql1:
On Error GoTo sqlError
Data1.RecordSource = sql1
Data1.Refresh
'If the resultset is empty add the value to the frequency table'
'Data1.Recordset.Seek "=", New_Freq'
If Data1.Recordset.BOF = True And Data1.Recordset.EOF = True Then
If Form14.Text1.Text <> "" Then
Form14.Text1.Text = Form14.Text1.Text + "MHz, " + Sto_Fr
ElseIf Form14.Text1.Text = "" Then
Form14.Text1.Text = Form14.Text1.Text + Sto_Fr
ElseIf F_Cnt = NO_OF_FREQ Then
Form14.Text1.Text = Form14.Text1.Text + Sto_Fr + "MHz"
End If
'MsgBox "Unable to Display Form14"'
'Increment F_Cnt'
'New_Freq = New_Check'
For New_Freq = New_Check To (New_Check + 0.025)
New_Freq = New_Freq + 0.001
sqlExecuteVHF
GoTo recordsetSql
recordsetSql:
On Error GoTo sqlError
Data1.RecordSource = sql
Data1.Refresh
If Data1.Recordset.BOF = True And Data1.Recordset.EOF = True Then
'No record Exists'
Flag = 1
Else
MsgBox "Frequency already Alloted."
Flag = 0
Exit For
End If
Next
If Flag = 0 Then
GoTo Skip
End If
'Move Left Side of the Sideband'
For New_Freq = New_Check To (New_Check - 0.025)
New_Freq = New_Freq - 0.001
sqlExecuteVHF
GoTo recordsetSql2
recordsetSql2:
On Error GoTo sqlError
Data1.RecordSource = sql
Data1.Refresh
If Data1.Recordset.BOF = True And Data1.Recordset.EOF = True Then
'No record Exists'
Else
MsgBox "Frequency in Range already Alloted."
'get a new New_Check'
Exit For
End If
Next
Skip: F_Cnt = F_Cnt + 1
Else
'MsgBox "record Exists"'
'If resultset is not empty, ignore the value'
End If
Loop
End If
Else
MsgBox "Enter Start and End Frequencies"
End If
Form14.Text1.Text = Form14.Text1.Text + "MHz"
Form14.Visible = True
'MsgBox Sto_Fr'
Exit Sub
sqlError:
MsgBox Err.Description
MsgBox "SQL Error"
End Sub
Private Sub Command4_Click()
Text13.Text = LF_B + LF_R + Amt_H
End Sub