Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub CmdAddText_Click()
On Error Resume Next
Dim mdl As Module
DoCmd.Hourglass True
DoCmd.OpenForm Me.FormName, acDesign, , , , acHidden
Set mdl = Forms(Me.FormName).Module
mdl.AddFromString Me.texttoadd
DoCmd.Close acForm, Me.FormName, acSaveYes
DoCmd.Hourglass False
End Sub
Private Sub Command4_Click()
Dim myForm As Form
Dim myControl As Control
'Dim myEvent As ??
Dim strFormName As String
'1. Create form
Set myForm = CreateForm()
'Set Name property
strFormName = "myFormTest"
myForm.Caption = strFormName
'2. Create Textbox
Set myControl = CreateControl(myForm.Name, 109)
'Set Textbox properties
With myControl
.Width = 1500
.Height = 200
.Top = 440
.Left = 200
End With
Private Sub Command15_Click()
Dim frm As Form, ctl As Control, mdl As Module
Dim lngReturn As Long
On Error GoTo Error_ClickEventProc
' Create new form.
Set frm = CreateForm
' Create command button on form.
Set ctl = CreateControl(frm.Name, acCommandButton, , , , _
1000, 1000)
ctl.Caption = "Click here"
' Return reference to form module.
Set mdl = frm.Module
' Add event procedure.
lngReturn = mdl.CreateEventProc("Click", ctl.Name)
' Insert text into body of procedure.
mdl.InsertLines lngReturn + 1, vbTab & "MsgBox ""Way cool!"""
Exit_ClickEventProc:
Exit Sub
Error_ClickEventProc:
MsgBox Err & " :" & Err.Description
'ClickEventProc = False
Resume Exit_ClickEventProc
End Sub
Sub AddClick()
Dim mdl As Module
Dim lngLine As Long
Dim strCode As String
'The code to be inserted.
strCode = "Private Sub cboCombo_Click()" & vbCrLf _
& vbvtab & "MsgBox ""Hi""" & vbCrLf _
& vbvtab & "End Sub" & vbCrLf
Set mdl = Forms!Form1.Module
'get the line number ...
lngLine = mdl.CountOfLines
'and insert the code.
mdl.InsertLines (lngLine + 2), strCode
End Sub