אוקי, הרצון הוא להוסיף TEXTBOX לתוך טופס פעיל
באקסס, צריך בזמן ריצה להשתמש בקוד הבא :
Dim frm As Form Dim ctlLabel As Control, ctlText As Control Dim intDataX As Integer, intDataY As Integer Dim intLabelX As Integer, intLabelY As Integer ' Create new form with Orders table as its record source. Set frm = Forms.Item("main") 'frm.RecordSource = "Orders" ' Set positioning values for new controls. DoCmd.OpenForm frm.Name, acDesign intLabelX = 100 intLabelY = 100 intDataX = 1000 intDataY = 100 ' Create unbound default-size text box in detail section. Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _ intDataX, intDataY) ' Create child label control for text box. Set ctlLabel = CreateControl(frm.Name, acLabel, , _ ctlText.Name, "NewLabel", intLabelX, intLabelY) ' Restore form. DoCmd.Restore
השורה המודגשת אמורה לפתוח את הטופס לעריכה בזמן ריצה, בהמשך אני מקבלל ERR, שלא ניתן לעדכן או למחוק....אובייקטים. העניין שאותו קטע קוד כאשר מריצים לטופס חדש שהוא יוצר אז אין בעיה ליצור אוביקטים בזמן ריצה, אבל אני רוצה רק לטופס הפעיל. היכן אני טועה. והקוד הוא מהאתר הרשמי של MS, בשינויים קטנים.