Frustrated by the absence of GridView I am trying to make one up using TextBoxes. But I am getting some odd results.
If I create a couple of TextBoxes:-
Code:
Set frm = Forms(strForm)
wLeft = wFirstLeft
wTop = wfirsttop
DoCmd.OpenForm strForm, acDesign
Set ctl = CreateControl(strForm, acTextBox, acDetail, , , wLeft, wTop, wWidth, wHeight)
ctl.Name = "txt" & "82001"
Set ctl = Nothing
DoCmd.Close ObjectType:=acForm, ObjectName:=strForm, Save:=acSaveYes
DoCmd.OpenForm strForm, acDesign
wLeft = wLeft + wWidth
Set ctl = CreateControl(strForm, acTextBox, acDetail, , , wLeft, wTop, wWidth, wHeight)
ctl.Name = "txt" & "82002"
Set ctl = Nothing
DoCmd.Close ObjectType:=acForm, ObjectName:=strForm, Save:=acSaveYes
I end up with THREE TextBoxes - txt82001, txt82002 and Textnn (next number allocated by designer
If I then Delete them
Code:
Set frm = Forms(strForm)For Each ctl In frm.Controls
MsgBox ctl.Name
If ctl.ControlType = acTextBox Then
MsgBox ctl.Name & " Deleted"
DeleteControl frm.Name, ctl.Name
End If
Next ctl
Set ctl = Nothing
Set frm = Nothing
It only deletes one or two of the three - never all three?????