VB Code To Load A Form

Mar 14, 2006

Hi Guys

How do I load a form from another form? I would prefer to use VB (in fact, its probably the only way you can do it!). I have tried varius commands that would have worked in VB - but dont work in Access, like...

Code:Unload MeLoad Form_tblClientsForm_tblClients.show

The above code does not work AT ALL. It gets an error at the Unload Me line, an error at the Load Form_tblClients line, and the action 'Show' does not even exist under Form_tblClients, so that wont work either!

I am aware of Switchborads, but i want to know how to load a form, and make it pop up in a new window from within another form.

View Replies


ADVERTISEMENT

Load Code Faster

Apr 10, 2006

hi
i have a form with 12 checkbox and 1 combobox
i use the following code


Option Compare Database
Private Sub Form_Current()
If Me.Image1 = -1 Then
Me.Parent.Image1.Visible = True
Me.Image1_text.FontBold = True
Else
Me.Parent.Image1.Visible = False
Me.Image1_text.FontBold = False
End If

If Me.Image2 = -1 Then
Me.Parent.Image2.Visible = True
Me.Image2_text.FontBold = True
Else
Me.Parent.Image2.Visible = False
Me.Image2_text.FontBold = False
End If
If Me.Image3 = -1 Then
Me.Parent.Image3.Visible = True
Me.Image3_text.FontBold = True
Else
Me.Parent.Image3.Visible = False
Me.Image3_text.FontBold = False
End If
If Me.Image4 = -1 Then
Me.Parent.Image4.Visible = True
Me.Image4_text.FontBold = True
Else
Me.Parent.Image4.Visible = False
Me.Image4_text.FontBold = False
End If
If Me.Image5 = -1 Then
Me.Parent.Image5.Visible = True
Me.Image5_text.FontBold = True
Else
Me.Parent.Image5.Visible = False
Me.Image5_text.FontBold = False
End If

If Me.Image6 = -1 Then
Me.Parent.Image6.Visible = True
Me.Image6_text.FontBold = True
Else
Me.Parent.Image6.Visible = False
Me.Image6_text.FontBold = False
End If

If Me.Image7 = -1 Then
Me.Parent.Image7.Visible = True
Me.Image7_text.FontBold = True
Else
Me.Parent.Image7.Visible = False
Me.Image7_text.FontBold = False
End If

If Me.Image8 = -1 Then
Me.Parent.Image8.Visible = True
Me.Image8_text.FontBold = True
Else
Me.Parent.Image8.Visible = False
Me.Image8_text.FontBold = False
End If

If Me.Image9 = -1 Then
Me.Parent.Image9.Visible = True
Me.Image9_text.FontBold = True
Else
Me.Parent.Image9.Visible = False
Me.Image9_text.FontBold = False
End If

If Me.Image10 = -1 Then
Me.Parent.Image10.Visible = True
Me.Image10_text.FontBold = True
Else
Me.Parent.Image10.Visible = False
Me.Image10_text.FontBold = False
End If

If Me.Image11 = -1 Then
Me.Parent.Image11.Visible = True
Me.Image11_text.FontBold = True
Else
Me.Parent.Image11.Visible = False
Me.Image11_text.FontBold = False
End If

If Me.ComboBox1 = "No" Then
Me.Parent.ComboBox1.Visible = False
Me.ComboBox1_text.FontBold = False
Else
Me.Parent.ComboBox1.Visible = True
Me.ComboBox1_text.FontBold = True
End If

If Me.Image12 = -1 Then
Me.Parent.Image12.Visible = True
Me.Image12_text.FontBold = True
Else
Me.Parent.Image12.Visible = False
Me.Image12_text.FontBold = False
End If
End Sub
Private Sub Image1_AfterUpdate()
If Me.Image1 = -1 Then
Me.Parent.Image1.Visible = True
Me.Image1_text.FontBold = True
Else
Me.Parent.Image1.Visible = False
Me.Image1_text.FontBold = False
End If
End Sub
Private Sub Image2_AfterUpdate()
If Me.Image2 = -1 Then
Me.Parent.Image2.Visible = True
Me.Image2_text.FontBold = True
Else
Me.Parent.Image2.Visible = False
Me.Image2_text.FontBold = False
End If
End Sub
Private Sub Image3_AfterUpdate()
If Me.Image3 = -1 Then
Me.Parent.Image3.Visible = True
Me.Image3_text.FontBold = True
Else
Me.Parent.Image3.Visible = False
Me.Image3_text.FontBold = False
End If
End Sub
Private Sub Image4_AfterUpdate()
If Me.Image4 = -1 Then
Me.Parent.Image4.Visible = True
Me.Image4_text.FontBold = True
Else
Me.Parent.Image4.Visible = False
Me.Image4_text.FontBold = False
End If
End Sub
Private Sub Image5_AfterUpdate()
If Me.Image5 = -1 Then
Me.Parent.Image5.Visible = True
Me.Image5_text.FontBold = True
Else
Me.Parent.Image5.Visible = False
Me.Image5_text.FontBold = False
End If
End Sub
Private Sub Image12_AfterUpdate()
If Me.Image12 = -1 Then
Me.Parent.Image12.Visible = True
Me.Image12_text.FontBold = True
Else
Me.Parent.Image12.Visible = False
Me.Image12_text.FontBold = False
End If
End Sub
Private Sub Image6_AfterUpdate()
If Me.Image6 = -1 Then
Me.Parent.Image6.Visible = True
Me.Image6_text.FontBold = True
Else
Me.Parent.Image6.Visible = False
Me.Image6_text.FontBold = False
End If
End Sub
Private Sub Image7_AfterUpdate()
If Me.Image7 = -1 Then
Me.Parent.Image7.Visible = True
Me.Image7_text.FontBold = True
Else
Me.Parent.Image7.Visible = False
Me.Image7_text.FontBold = False
End If
End Sub
Private Sub ComboBox1_AfterUpdate()
If Me.ComboBox1 = "No" Then
Me.Parent.ComboBox1.Visible = False
Me.ComboBox1_text.FontBold = False
Else
Me.Parent.ComboBox1.Visible = True
Me.ComboBox1_text.FontBold = True
End If
End Sub
Private Sub Image8_AfterUpdate()
If Me.Image8 = -1 Then
Me.Parent.Image8.Visible = True
Me.Image8_text.FontBold = True
Else
Me.Parent.Image8.Visible = False
Me.Image8_text.FontBold = False
End If
End Sub
Private Sub Image9_AfterUpdate()
If Me.Image9 = -1 Then
Me.Parent.Image9.Visible = True
Me.Image9_text.FontBold = True
Else
Me.Parent.Image9.Visible = False
Me.Image9_text.FontBold = False
End If
End Sub
Private Sub Image10_AfterUpdate()
If Me.Image10 = -1 Then
Me.Parent.Image10.Visible = True
Me.Image10_text.FontBold = True
Else
Me.Parent.Image10.Visible = False
Me.Image10_text.FontBold = False
End If
End Sub
Private Sub Image11_AfterUpdate()
If Me.Image11 = -1 Then
Me.Parent.Image11.Visible = True
Me.Image11_text.FontBold = True
Else
Me.Parent.Image11.Visible = False
Me.Image11_text.FontBold = False
End If
End Sub



how to optimize my code to run faster???

the images are 1 KB size , 16x16 pixels and .bmp
All of them are insert inside db.

i think images are too small to slow down my code.
Can i write the code in a different way?

View 1 Replies View Related

Refresh After Code Runs On Activate Or On Load

Jul 21, 2015

Access 2007, Sql Server 2008 R2. Problem with refresh.

Form 1, (Single Form) Parent Form, contains Property Year Detail data. PK = PropYrDetID. This is a SINGLE FORM

Form 2, (Single Form) Child form, contains land square footage data from multiple records. PK = SPYDID FK = PropYrDetID. This is a SINGLE FORM.

The code below executes every time Form 1 opens, activates or whatever. The reason is that data in Form 2 changes frequently. Thus every time Form 1 opens the end user will see the latest data.

"Form 1" receives a series of values that it obtains from VBA code that runs when it opens or activates.

"Form 2" has the data being summarized in Form 1.

All of the code and queries below run fine and return the correct values from Form 2 to Form 1. My problem is Refresh on Form 1.

I've tried the code in the On Current, On Activate, On Load of Form 1. Mostly the data shows up in Form 1. Other times parts of the data are left out. I have to hit F5 or close and reopen the form, and then the data appears. When I don't see data on Form 1, I check the underlying table and the correct data exists. I don't know how to achieve a 100% refresh success. I have tried me.refresh and different Events all over the place.

All of the code below runs when Form 1 opens. Queries are fine, Equations are fine, Tests run fine. It's the results showing up that I am having the problem with.

I don't think the issue is with the code but with the Refresh. Here it is for your review.

The term "Equations" is the customers. There are 5 equations. Some have a series of tests after the Equation to determine the result.

Code:

Private Sub Form_Activate()
Dim rs As Variant
Dim varAOProp As Variant
Dim varAOIni As Variant
Dim varAOCert As Variant
Dim varBORIni As Variant
Dim varBORFinal As Variant

[Code] ....

View 5 Replies View Related

General :: Code Error When Load Data From Server

Jun 5, 2014

Im using ms access 2010 and this program compatible with previously ms access.the error show is type mismatch (error 13) on

Code:

Set rbs = CurrentDb.OpenRecordset("SELECT MSysObjects.Name" _
& " FROM MSysObjects WHERE MSysObjects.Type= 1 And MSysObjects.Flags=0" _
& " and MSysObjects.Name='" & n_tb & "'")

View 2 Replies View Related

On Load Property VB Code To Limit Records In Main File.

May 3, 2005

I have an Access application for which I would like to provide potential customers with a fully functional application but with a limit to the number of records that can be stored in the main file.

I would like to have a message displayed to say "The maximum number of records have been reached for this application."

Could you help with the VB code required to do this? The module will become active at the "On Open" property when the main Form is opened.

Thank you.

Regards,

Clive Shakespeare

View 2 Replies View Related

Load A Form At The Begining?

Oct 19, 2005

Hello? I did a form and I want that when somebody opens the database it opnes automatically, it has a series of buttons to open another things.

Thanks

View 1 Replies View Related

Load New Form And Set Textbox Value...

Feb 24, 2006

I have 1 form lets call it Form1 which has a text box called say textBox1(along with many other form components), the will find record they want and then click a button, which i want to open a new different form (Form2) and set a text box on that form (textBox2) to the value of the textBox in Form1.


Dim tmp As String
tmp = VolunteerID.Value

DoCmd.OpenForm "Comment", acNormal, , , acFormAdd, acWindowNormal
DoCmd.GoToRecord , , acNewRec
'To obtain that varibale was read.
MsgBox (tmp)
'Not sure if this is needed
'VolunteerID2.SetFocus
VolunteerID2.Text = tmp


Cheers in advance

View 1 Replies View Related

Maximize Form On Load

May 22, 2006

I have some trouble getting a form to open maximized. This form is opening from a switchboard that is centered and not sizable. After clicking on a command button in the switchboard the form I am having trouble with opens in its own window, but I cannot get it to maximize automatically. I have been to every setting I know on the form properties but for some reason nothing seems to be able to get that form to open maximized.:confused:

Heeeeeeeeeeeeelp!!!!!

mafhobb

View 3 Replies View Related

Maximize Form On Load

Nov 14, 2006

how to maximize the form when you load it?

View 1 Replies View Related

How Do I Load A BLOB Into A Form?

Oct 5, 2007

Hello,

I have a OLE Object field in my Access table. It has a blob (long binary data) already in it. It is a very small .bmp image. How do I get this image from the table loaded in a form to it displays the image? I tried setting this value to a image box, bound object field on form load but nothing is working. Any help would be great. Thanks

Joe

View 2 Replies View Related

How To Load A Record On A Form

Jun 14, 2014

I only have one table that both forms pull from.

I have 3 forms. The only form a user will ever see is F_Main

F_MAIN (Just loads the 2 forms below within itself)
F_Data_Short (Grid View.. Rows and Columns.. All Records.. Shows some fields)
F_Data_Long (Single Record View.. Showing all fields)

F_MAIN
-> On the left is F_DATA_SHORT
-> On the Right is F_DATA_LONG

How can I set it.. When a record on the left included form is clicked.. it loads that same record on the right included form. No pop ups...

I know I can use the On Click option for the form on the Left... and set code or a macro to the load the data on the right. I tried everything and can't seem to get the data to load on the right when a record is clicked on the left...

View 2 Replies View Related

Update =Date() On Form Load

Jul 27, 2007

I have a form, that when I create a new record it puts a a =Now() time stamp in the Date Field, but I would like for that time to be updated if anything on the record is changed, later on. How do I update that time?

View 3 Replies View Related

Form Does Not Load Until Loop Has Finished

Jan 3, 2008

Hi

I have created a small form that hold a cube of 9 boxes on it. The idea is that it will act as a small icon that indicates the system is loading. (Purely cosmetic)

I have triggered the boxes to change colour on a loop when the form loads but the problem is that the loop function is being carried out before the form actually loads. How do I get the form to display first and then carry out the loops to change the colour of the shapes?

Thanks all...

View 5 Replies View Related

Is There Anyway To Auto Maximize A Form On Load?

Feb 28, 2005

I want my Switchboard, and all subsequent forms to be maximized on open...so that the form name doesn't show. Is that possible?

View 5 Replies View Related

Open Invisible Form On Load

Mar 23, 2005

How do you open an invisible form when the database opens. In the database's startup options I have the database open a form, however, for some reason I can't set it to an invisible state.

My users run macros in their programs (not forms) the sole purpose of the form is to track which users are logged in the database or not. Therefore, when the form opens/closes, a user-table updated.

I don't want the users to be able to see this form, but I have no way to keep it hidden. More importantly because no other forms are being used or opened on load... I can't open the form hidden. Does anyone know anyway around this?

View 6 Replies View Related

Calculated Fields On Load Of Form

May 4, 2005

Could someone tell me what Event I need to put this code in to calculate my fields when the form first opens?

I have this code on both the After Update and On Change events which is working fine, but, when I first open the form, those calculated fields are blank and I have to perform a change or update before the calculations will appear each time.

If Not IsNull(Me.fcstloc) Then
Me.prodvolume = DSum("[volume]", "qryMonthlyEngineVolumes", "[product] = '" & Forms!Projects!product & "'" & " And [MonthID] Between " & Forms!Projects.MonthID.Column(0) & " And 12")
ElseIf Not IsNull(Me.prodvolume) Then
Me.prodvolume = DLookup("[2004volume]", "tblProjectDetails", "[projectid] = " & Forms!Projects!projectid & "")
End If

Thanks!
Toni

View 1 Replies View Related

Form Load On Database Start

Dec 7, 2005

Hi

how do I setup a "welcome" form to start on database start?

miha

View 2 Replies View Related

How To Load A Form Into Memory Without Showing It?

Jun 26, 2006

How can I Load a Form into Memory without showing it?

I have a DB with some Forms. None of them are open. I want to check some properties of each form without actually opening them. How can I do this. Probably by loading it.
Can anybody tell me how to use the LOAD command to load the Form?:o

View 4 Replies View Related

Load Form Music Play

Jul 26, 2006

Hi,
Friend I am bigner in ms acess I have datbase .
I want when I load main page sound/music .
when i open another page I want another soundplay that music
.

Plz ur help
Thanks from Iraqi

View 4 Replies View Related

Auto Load Form On Open

Sep 8, 2006

Hiya people, was wondering i know that its probably in search and i did have a look but as its the Weekend i won't be able to work on it and want a quick fix if possible, when i open the database i want a menu form to load automatically? Any Ideas?

View 5 Replies View Related

Forms :: On Load Form Error

Apr 3, 2014

I have built a database which has a number of forms with a frm_PartNo subform in.When ever I click a button to load one of these forms I get the following error message: ECN Database v1.31 cannot find the referenced form 'frm_PartNo'. But when the form loads the sub form is there with all the related data !

View 5 Replies View Related

Modules & VBA :: Load Sub Form From Variable?

Dec 29, 2013

I have a form which load data from variables in record set where i can make insert update and delete i need to load sub form when the form load the problem is that all text boxes in main box load from variable which are in rerecord set and how can navigate using navigation buttons in main form.

View 2 Replies View Related

Forms :: Maximize Form On Load

Nov 2, 2013

I'm a newbie using Access 2007.I am trying to make things as easy as possible for the user of a database that I have been working on. The users maximum screen resolution is 1600 x 900 and I want to have specific forms automatically "maximise" to fit the screen.I have set the Form property "Fit to Screen=Yes" but it does not do what I am expecting and want.I also have "Auto Resize=Yes"

View 4 Replies View Related

Forms :: Filtering On Form Load

Aug 9, 2013

I am having a problem filtering a form on load.What I am trying to say is if the role = Agent then filter on todays completed records and records that have a completed date of Null for the particular agent.

Here is the code:

If Me.txtRole = "Agent" Then
AgentFilter = "(CASEOWNER ='" & Me.txtName & "')"
DateCompletedFilter = "((DATECOMPLETED = #" & Date & "#)OR (DATECOMPLETED Is Null))"
DoCmd.ApplyFilter , AgentFilter & " And " & DateCompletedFilter
Exit Sub
End If

The filter on the agents works and the filter on the completed date of null apeears to work however when a record is completed it diappears on refreshing of the form even though the record has been completed on todays date.I have investigated the code an the issue appears to be with the DATECOMPLETED = #" & Date & "# part of the code.

View 5 Replies View Related

Forms :: Load Form With Max Date

Jul 19, 2013

I'm trying to open a specific set of records when the form is first opened (namely the most recent date that was added). I'm trying something along these lines and am simply unable to get it to work:

Private Sub Form_Load()
Dim strQry As String
strQry = DMax("TranDte", "Transaction")
DoCmd.OpenForm "FrmSalesInp", acNormal, "", "[Transaction]![TranDte]="
& strQry, , acNormal
End Sub

View 5 Replies View Related

How To Get A Button To Load A Query On Form

Mar 8, 2015

I know how to filter my form so I get the records from a certain query by clicking Advanced>Filter by Form>Load From Query>Selecting the query I want> Toggle filter. What I want is a button that will do this just by clicking it. By default I have set my form to load a blank record. I also have a button to filter by an exact ID number. What I can't figure out is how to write the expression/macro to acheive this on my "Unprocessed button". The red button is the one I need to apply my query to.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved