Good Day,
firstly, I would like thank you for your help and I learned a lot from it.
last week you helped me with code about replacing the checkbox labels and it is working.
However, is there a way to replace the textbox?
I mean if one cell is empty no need to show the textbox of it and make the next one in its place.
i tried by modifying the previous code but it did not work.
Your help is really appreciated.
Thank you in advance.
firstly, I would like thank you for your help and I learned a lot from it.
last week you helped me with code about replacing the checkbox labels and it is working.
However, is there a way to replace the textbox?
I mean if one cell is empty no need to show the textbox of it and make the next one in its place.
i tried by modifying the previous code but it did not work.
Your help is really appreciated.
Thank you in advance.
first, question, is LA, NY, LND the control source ( field name) of your checkboxes?
if so you need to code your Form's Current event.
before that, you need to adjust the width of your labels (wider than LND label).
next, you also need to rename all your controls.
for labels, rename them in sequence (from left to right) as lblChk1, lblChk2, lblChk3.
same with your checkboxes. starting from Left Chk1, Chk2, Chk3.
Code:Private Sub Form_Current() Dim i As Integer Dim aLabel() As String Dim aControlSource() As String ReDim aLabel(0) ReDim aControlSource(0) On Error Resume Next With Me ' hide all labels and checkboxes .lblChk1.Visible = False .lblChk2.Visible = False .lblChk3.Visible = False .chk1.Visible = False .chk2.Visible = False .chk3.Visible = False If Nz([LA], False) = True Then ReDim Preserve aLabel(UBound(aLabel) + 1) ReDim Preserve aControlSource(UBound(aControlSource) + 1) aLabel(UBound(aLabel)) = "LA" aControlSource(UBound(aControlSource)) = "LA" 'should be replaced with correct fieldname" End If If Nz([NY], False) = True Then ReDim Preserve aLabel(UBound(aLabel) + 1) ReDim Preserve aControlSource(UBound(aControlSource) + 1) aLabel(UBound(aLabel)) = "NY" aControlSource(UBound(aControlSource)) = "NY" 'should be replaced with correct fieldname" End If If Nz([LND], False) = True Then ReDim Preserve aLabel(UBound(aLabel) + 1) ReDim Preserve aControlSource(UBound(aControlSource) + 1) aLabel(UBound(aLabel)) = "LND" aControlSource(UBound(aControlSource)) = "LND" 'should be replaced with correct fieldname" End If ' show the labels and control if there is For i = 1 To UBound(aLabel) .Controls("lblchk" & i).Caption = aLabel(i) .Controls("chk" & i).ControlSource = aControlSource(i) ' make them visible .Controls("lblchk" & i).Visible = True .Controls("chk" & i).Visible = True Next End With End Sub