A
Ayo
I have a form with option buttons, 1 combobox, 1 textbox and a few buttons.
What I am trying to do is to get a value and put it in the textbox based on
what is in the combobox and what is selected from the option button.
My problem is that when I select an option and input a value into the
combox, the text box is still empty. What am I doing wrong?
For Each optProject In fraProject.Controls
If optProject.Enabled = True And optProject.Value = True Then
ActiveSheet.Range("B1").Value = frmReport.cboSiteID.Value
ActiveSheet.Range("G1").Value = Mid(optProject.Name, 4, 6)
If Left(ActiveSheet.Range("G1").Value, 1) = 8 Then
ActiveSheet.Range("G1").numberFormat = "000000"
ElseIf Left(ActiveSheet.Range("G1").Value, 1) <> 8 Then
ActiveSheet.Range("G1").numberFormat = "00000"
End If
For Each c In Worksheets("Key").Range("B:B").Cells
If IsNull(frmReport.txtTask.Value) Then
If c.Value = frmReport.cboSiteID.Value Then
If c.Offset(0, -1).Value = Mid(optProject.Name, 4, 6) _
Or c.Offset(0, -1).Value = Mid(optProject.Name, 4,
5) Then
frmReport.txtTask.Value = c.Offset(0, 1).Value
Exit For
End If
End If
ElseIf Not IsNull(frmReport.txtTask.Value) Then
Exit For
End If
Next
ActiveSheet.Range("I1").Value = frmReport.txtTask.Value
ActiveSheet.Range("I1").numberFormat = "0000"
ActiveSheet.Range("K1").Value = Date
End If
Next optProject
What I am trying to do is to get a value and put it in the textbox based on
what is in the combobox and what is selected from the option button.
My problem is that when I select an option and input a value into the
combox, the text box is still empty. What am I doing wrong?
For Each optProject In fraProject.Controls
If optProject.Enabled = True And optProject.Value = True Then
ActiveSheet.Range("B1").Value = frmReport.cboSiteID.Value
ActiveSheet.Range("G1").Value = Mid(optProject.Name, 4, 6)
If Left(ActiveSheet.Range("G1").Value, 1) = 8 Then
ActiveSheet.Range("G1").numberFormat = "000000"
ElseIf Left(ActiveSheet.Range("G1").Value, 1) <> 8 Then
ActiveSheet.Range("G1").numberFormat = "00000"
End If
For Each c In Worksheets("Key").Range("B:B").Cells
If IsNull(frmReport.txtTask.Value) Then
If c.Value = frmReport.cboSiteID.Value Then
If c.Offset(0, -1).Value = Mid(optProject.Name, 4, 6) _
Or c.Offset(0, -1).Value = Mid(optProject.Name, 4,
5) Then
frmReport.txtTask.Value = c.Offset(0, 1).Value
Exit For
End If
End If
ElseIf Not IsNull(frmReport.txtTask.Value) Then
Exit For
End If
Next
ActiveSheet.Range("I1").Value = frmReport.txtTask.Value
ActiveSheet.Range("I1").numberFormat = "0000"
ActiveSheet.Range("K1").Value = Date
End If
Next optProject