Introduction to Windows form

The Windows form is a component that contains many controls. These forms allow you to insert and display data and update or delete data in the database. In short, they serve as an interface between the user and the database.

Microsoft Access provides form checks directly in the host window, and fortunately they don’t need a lot of code. These forms are easy to use compared to other GUI forms offered in other programming languages or by the VBA Editor.

Form controls such as text fields, combo fields, etc. can be directly linked to the fields in the various tables via the Properties window. This saves you a lot of time and reduces coding and maintenance costs.

Here is a picture of a shape developed with different controls.

alt=In the employee’s salary form, ready for data entry – at origin width=1312 data-orig-height=543 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/Initiating-or-Opening-a-Windows-Form-in-Microsoft-Access.png data-ez= />

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

You can create a form using the Create menu. It offers different shapes to choose from according to your needs.

alt=Data Usage-Original-Width=1216 Data-Original-Height=522 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/1607246602_7_Initiating-or-Opening-a-Windows-Form-in-Microsoft-Access.png data-ez= />

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

Opening the form at runtime

Docmd.Openform is a method that can be used to load/open a form at runtime.

Syntax

DoCmd.OpenForm (

Top of Form

, [

Bottom of Form

Top of Form

] ,[ ], [] , [] , [] , [])

Explanation of the syntax parameters of

Name of form

The name on the form is you! You will find it in the All Access Points window on the left side of the Access application. Some sample project names are available as a reference in the figure below.

alt= The link between the form names and the presence of employees is marked: data-orig-width=381 data-orig-height=270 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/1607246603_552_Initiating-or-Opening-a-Windows-Form-in-Microsoft-Access.png data-ez= />

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

View form

There are different values for this, as shown below. This parameter is optional.

  • acDesign is set to 1 and opens a form in Design View – (i.e.) allows the user to change the open form.
  • acFormDS has a value of 3 and opens the form from the point of view of the data table .
  • acFormPivotChart is set to 5 and opens a form in the PivotCart view.
  • acFormPivotTable has a value of 4 and opens a form in the PivotTable view.
  • acLayout is set to 6 and opens the form for layout.
  • acNormal has the value 0 and opens a form in the normal window.
  • acPreview is set to 2 and opens the form in the print preview window.

If this argument is not passed, acNormal becomes the default view and opens the form with a normal view.

Filter name

Query string or query name already created in the Access project.

Pay attention: A recording source may not be used here.

Below is an example of a query screen in the Access project. Several requests have been drawn up and are available on the left hand side.

Three views (Data Table View, Design View and SQL View) are available in the Design menu to access any question. The SQL query type is open for reference.

alt= View Request for use in SQL view form data-orig-width=1563 data-orig-height=722 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/1607246604_725_Initiating-or-Opening-a-Windows-Form-in-Microsoft-Access.png data-ez= />

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

Where condition

The point where the SQL query is at the top, but without the keyword. This is nothing more than a condition that is automatically added to the previous parameter of the filter name.

Mode of data transmission

The mode in which the form is to be opened when the form or data table is displayed. This can be one of the following options. It’s an optional argument.

  • acFormAdd with a value of 0 : We cannot change existing documents, but we can add new ones.
  • acFormEdit with a value of 1 : We can add new entries and modify existing ones.
  • acFormPropertySettings with the value -1 : We have the right to change the properties of the form.
  • AcFormReadOnly with the value 2 : We can only display records from a related table or database through the open form interface.

acFormPropertySettings is the default value if no data mode is passed as an argument.

Window position

Sets the mode of the display window. It’s an optional argument. The value may be one of the following:

  • acDialog with a value of 3. It sets the properties of the pop-up and modal window or report window to Yes.
  • hidden with a value of 1. He’s hiding a report or a form.
  • Symbol with a value of 2. This opens a form or report, but reduces it to the Windows taskbar.
  • AcWindowNormal with a value of 0. This opens a form or report in the mode specified by its properties. This is the default value if this argument is not passed.

Argentina outdoors

It is also an optional argument that can be used in both expressions and macros. It opens a form with a specific record whose meaning is specified in this argument. Once the form is opened, the control can be moved back and forth or to a specific record using the findRecord method.

Examples

Example 1

The code below opens an employee form in normal mode with all default options. However, for a better understanding of the example, all standard options are listed here.

Private Subcommand583_Click()

Set the value for cause
in Search criteria = [Personnel data]. [Goal] = & “Teacher.

Assign the query value for easy use of a variable
strQuery = * of [Personnel data].

Open a form with the specified modes
DoCmd.OpenForm Employee Details, acNormal, strQuery, search criteria, acFormEdit, acWindowNormal

Last sub-heading

Here is a screenshot in case the corresponding command key is pressed

alt= data-orig-width=1440 data-orig-height=810 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/1607246605_995_Initiating-or-Opening-a-Windows-Form-in-Microsoft-Access.png data-ez= />

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

Example 2

This code has different modes and a different location. Display mode here – Display specifications.

Private Subcommand583_Click()

Set the value for cause
in Search criteria = [Personnel data]. = & Elementary school teacher.

Assign the query value for easy use of a variable
strQuery = * of [Personnel data].

Open a form with the specified modes
DoCmd.OpenForm employee data, acFormDS, strQuery, search criteria, acFormReadOnly, acDialog

Last sub-heading

alt= data-orig-width=1440 data-orig-height=810 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/1607246606_686_Initiating-or-Opening-a-Windows-Form-in-Microsoft-Access.png data-ez= />

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

Example 3

The following code displays the layout view.

Private Subcommand583_Click()

Define the value in case clause
Search criteria = [personnel data]. = & high school teacher.

Assign the query value for easy use of a variable
strQuery = * of [Personnel data].

Open a form with the specified modes
DoCmd.OpenForm Clerk Details, acLayout, strQuery, search criteria, acFormReadOnly, acWindowNormal

Last sub-heading

alt= data-orig-width=1440 data-orig-height=810 data-ezsrc=http://server.digimetriq.com/wp-content/uploads/2020/12/1607246607_531_Initiating-or-Opening-a-Windows-Form-in-Microsoft-Access.png data-ez= />

alt=Plug in! data-ezsrc=/utilcave_com/social/pin_it.png />

alt=Change to Facebook data-ezsrc=/utilcave_com/social/fb_share.png />

Conclusion

The Docmd.OpenForm method is basically used to open a form at any time – for example when loading another form or pressing a button. The parameters of the method help us to change the display mode, the list of data to be displayed and the output mode of the form.

I recommend you try it with all the optional parameter values available in each dummy database to better understand these arguments.

Bottom of Form

form load event in vb,access form open event,vba access form activate event,vba activate access,ms access form on current,form activate event vba,system.windows.forms nuget,system.windows.forms.dll location,system.windows.forms does not exist,system.windows.forms c#,windows forms tutorial,how to call a class in windows form c#,visual studio form size problem,c# form size not changing,c# winforms resize form programmatically,c# form resize event,vb.net allow user to resize form,how to fix the size of windows form in c#,how to start ms access 2010,how to start ms access 2016,how to open ms access in windows 10,what are the steps of creating table,write steps to start ms access on computer,how to create form in ms access step by step,access 2016 open form to blank record,access vba open empty form,access vba go to blank record,access open form to new record,how to create a blank form in access,ms access save record and clear form,sample ms access database projects,features of ms access,ms access 2010 complete tutorial pdf,microsoft access 2013 complete pdf,ms access definition,microsoft access exercises with answers pdf,open the workshops form in form view,open a database object in form view,rename the workshop report,open the class form access quizlet,start ms access hidden,how to open a form in form view in access,ms access vba code examples,how to run vba code in access,access vba book,ms access vba code examples pdf,access vba tutorial,visual basic access database,what is microsoft access used for,microsoft access tutorial,microsoft access alternative,microsoft access download,microsoft access 2007,access form load event,access form events,form load event vba,microsoft access form open event,on current form access,access form code,windows forms

You May Also Like

🥇 Calculate the Cost of a Product in Excel  Step by Step Guide ▷ 2020

If you want to sell a product or offer a service to…

🥇 MICROSOFT POWERPOINT  What is it? + Alternatives ▷ 2020

One of the advantages of using Office software packages is that you…

Pytorch Image Augmentation using Transforms.

In-depth learning models generally require a lot of data for learning. In…

Fix: Google Photos not backing up on iPhone

For many iPhone users, Google Photos remains the first choice, even though…