If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Creating a new form using vba code only .... any ideas
Hi all, I want to create a form using vba. Iv'e got Dim frm as new form. but some of the design time tools such as create object do not work. It appeqrs that when you invote a new form it's live and not in design view.. any ideas of how to do it. Thanks in advance Russ |
#2
|
|||
|
|||
Creating a new form using vba code only .... any ideas
Hi Russ,
Copy and paste this code to a new standard module and run it right from the immediate window. It will create a new form with a very pleasant label and save it. You should be able to study the code and see what is going on. Also look in the Help files for CreateForm and CreateControl for other samples. Public Function funcCreateForm() On Error GoTo ErrorPoint Dim frm As Form Dim ctlLabel As Control ' Create the form and set properties Set frm = CreateForm frm.Caption = "Access Junkie" frm.AutoCenter = True frm.NavigationButtons = 0 frm.RecordSelectors = 0 frm.ScrollBars = 0 frm.Width = 5760 frm.Section(0).Height = 2880 frm.Section(0).BackColor = -2147483633 frm.AllowEdits = False frm.AllowDeletions = False frm.AllowAdditions = False frm.AllowFilters = False frm.ShortcutMenu = False frm.ViewsAllowed = 0 ' Create the label Set ctlLabel = CreateControl(frm.Name, acLabel, _ , , "Access Junkies Rule The World!", 1440, 720, 2880) ' Save and close the form DoCmd.Close acForm, frm.Name, acSaveYes ExitPoint: Exit Function ErrorPoint: MsgBox "The following error has occurred:" _ & vbNewLine & "Error Number: " & Err.Number _ & vbNewLine & "Error Description: " _ & Err.Description _ , vbExclamation, "Unexpected Error" Resume ExitPoint End Function -- Jeff Conrad Access Junkie Bend, Oregon -----Original Message----- Hi all, I want to create a form using vba. Iv'e got Dim frm as new form. but some of the design time tools such as create object do not work. It appeqrs that when you invote a new form it's live and not in design view.. any ideas of how to do it. Thanks in advance Russ |
#3
|
|||
|
|||
Creating a new form using vba code only .... any ideas
Your a star.. Cheers man Russ |
#4
|
|||
|
|||
Creating a new form using vba code only .... any ideas
You're welcome, glad to help.
-- Jeff Conrad Access Junkie Bend, Oregon "Russ" wrote in message ... Your a star.. Cheers man Russ |
Thread Tools | |
Display Modes | |
|
|