A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Creating a new form using vba code only .... any ideas



 
 
Thread Tools Display Modes
  #1  
Old June 8th, 2004, 01:11 AM
Russ
external usenet poster
 
Posts: n/a
Default 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  
Old June 8th, 2004, 03:25 AM
Jeff Conrad
external usenet poster
 
Posts: n/a
Default 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  
Old June 8th, 2004, 04:01 PM
Russ
external usenet poster
 
Posts: n/a
Default Creating a new form using vba code only .... any ideas




Your a star..


Cheers man

Russ
  #4  
Old June 8th, 2004, 07:21 PM
Jeff Conrad
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.