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 Replies
ADVERTISEMENT
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 3 Replies
View Related
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
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
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
May 8, 2007
Hi,
I am opening a query in Access which has two linked sql tables but it takes to long to open. Can I choose a method (ADO) opening that query? If not, is there a way to speed up the process?
thanks
View 1 Replies
View Related
Mar 26, 2008
See attached image. I am looking for ways to make my query run faster. When I run this query for small groups which will return less than 100 records, the query takes about 30 seconds. However I have some groups that have over 1000 records and that will take 3-5 minutes to run. Actually sometimes the query even bombs after 30 seconds on the large groups.
This query hits against a linked SQL database. Three of the fields gets the criteria from a form combo box. The thing that makes this query take so long is the Count. It counts the number of times the Signature Type "duedte" has been changed.
I am looking for any suggestions for how to speed this up. I want real time results so I was not sure if copying the data locally each time then running the queries would help any in the overall time.
I appreciate any suggestions.
Jim
View 5 Replies
View Related
Mar 10, 2008
I revised my DB thinking that one big form divided by Page Tabs would speed things up. Wrong. It slowed everything down to a crawl. I found the more I broke up Forms into sub-forms the faster things went.
Incidentally this may be the answer to the problem I posted about Permission Lockups. (See Access 2000 Permission lockup posted on 2/20/08). I noticed that the big form version requested to save forms that I think I had not even opened. So when I encountered the problem on installing the DB on my network, I just did two or three saves just for luck. This seemed to do the trick. This suggested that my Permission Lockup may have been due to not all Forms had been saved on closing.
The evidence is circumstantial but I have had no trouble since.
View 1 Replies
View Related
Aug 6, 2013
Im new in using MS Access. How i can "tick" the yes/no button faster. I have almost 3,000 boxes to tick and its making my wrist ache... Unlike in excel where i can just drag it to the last cell....
View 1 Replies
View Related
Oct 11, 2006
Hi
I have some drop downs on my form, which has some code that decides which recordsource to use.
When I first select an option from the drop down, the query takes 10 seconds to load data.
I then select another option, which runs a different query, which takes x seconds.
If I then select the original option from the dropdown, the data loads onto the form in less than a second.
Why is there a delay the first time round and not the next? Has Access saved some kind of query plan? If so, why doesn't it save it permanently?
View 1 Replies
View Related
Jul 9, 2013
My report has in each row at least 1 picture which is about 1.5" square when open; however, when trying to scroll up or down the pictures dazzles on and off while the pausing the scroll which moves slowly. If the pictures are removed the scrolling movement is normal.
How can this report scrolling be made more efficient?
View 3 Replies
View Related
Feb 16, 2006
Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.
Where did I go wrong?
Private Sub Form_Load()
Dim pw As Variant
If InputBox("What is the password?", "Password") = "1" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
If InputBox("What is the password?", "Password") = "2" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
End If
End If
End Sub
View 14 Replies
View Related
Jan 14, 2007
I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"
Is there a way to write code that will remove that Lock Project check and check it back on?
I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.
Thanks
SHADOW
View 6 Replies
View Related
Aug 23, 2005
I need my menu form to load automatically (pop up) when you load up the database... i.e exactly like it does with the switchboard in the templates for access.
Cheers,
Andy
View 1 Replies
View Related
Apr 5, 2006
Load my DB from ram
--------------------------------------------------------------------------------
hi
i have read that it is possible to upload my db in ram memory and open it from there. When i finished my work to save it at a external drive.
How can i do this ? or where to read ? or sample db ? or better a code ?
thxs
*i know that if i close my db before a save it at the drive , i will lose all the new records.
i have a friend and he bought a program(made by vb).
The program is stored in a usb flash drive and every morning he plug the flash run a small utility which upload the main program at ram. Then he unplug the flash and start working with the program.Everything is being saved at Ram. When he want to leave , plug the flash and run the utility which save the program at the flash.
If he close the program and he hasn't run the utility , he is losing the new entries.
The reason he is doing...
Simple to hide things that he is saving at the program.
So
1)Plug the usb
2)run the utility to upload the app
3)unplug the usb
4)work at the app
5)plug the usb and save data
if someone try to see the app , he is closing it or unplug the pc from electricity.
he will lose only the new data.
Simple
Good for people how want to hide stuff (will taxes)
__________________
Alexandros
View 2 Replies
View Related
Feb 11, 2008
Hi,
Im looking to have a particular form open on load of the database and in a uniform size. As well as this I would like have all fields on one of my forms disabled when I click to enter this form. Any help would be appreciated!
View 2 Replies
View Related
Feb 28, 2006
This should be an easy one, just not for me.
I have a combo box on my form, when the form loads the combo box is blank, but the records attached to the first item in the combo box are loaded in the subform on the form so it appears that I have records attached to nothing (which isn't the case). Basically, I want the first item in the combo box to be visible on load so that the records in the subform don't look orphaned.
Any help would be appreciated.
Thanks.
View 1 Replies
View Related
Sep 19, 2005
Hello,
I have a client who downloads data from a website. I must then put this data into an access database. The problem I am having is that the file is a strange format - it comes to me as filename.servlet[3]
I am assuming that this is some kind of java file, but am not really sure. I can open it with notepad and it looks like a comma delimited file, but i can't figure out how to get it into an access table.
Does anyone have any idea how to handle this file?
Any thoughts would be appreciated.
Thanks.
View 1 Replies
View Related
Apr 28, 2005
I was wondering if it is possible to load multiple forms into one subform? For example: I have form [SO2Menu] and form [Critical]. Can I have one subform in a main form that by the click of a button ill load either menu depending on the users selection?
View 1 Replies
View Related
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
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
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
Nov 2, 2006
:confused: I have a particular Windows XP Home edition machine that is giving me a headache...
On the DB - users can access a form that displays pictures in a Picture control (via file path) with no problem at all. The problematic machine displays 'Access does not recognise the file format and so can't load the picture....' or something of that ilk....
Yet the file format is JPG and if I use the qualified path (on this same machine), eg. \SERVERFolderPicsPICTURE.JPG from the XP Start/Run menu - XP Image viewer opens and displays the JPG with no problem at all!
Why is this happening only on this XP machine and not on the others..???
Any ideas would be greatly appreciated - thanks in advance.
Regards
Guido
View 2 Replies
View Related
Nov 14, 2006
how to maximize the form when you load it?
View 1 Replies
View Related
Dec 5, 2006
Hello all,
I have a continuous form that is slow on loading a portion of the code. The form is designed to pull students who need to be either warned or terminated based off of their GPA. Below is the code that is delayed in being displayed on the form:
Public Function warnOrTerminate(creditAttempt As Integer, GPA As Double)
' these numbers are from the "satisfactory progress" portion of the catalog
'warning if the following is true
'GPA<1.5 and ([cAttempt]<=15)
'GPA<1.9 and ([cAttempt]>=16 and [cAttempt]<=30)
'GPA<2.2 and ([cAttempt]>=31 and [cAttempt]<=45)
'GPA<=2.4 and ([cAttempt]>=46)
'terminate if the following is true
'GPA<1 and ([cAttempt]<=15)
'GPA<1.5 and ([cAttempt]>=16 and [cAttempt]<=30)
'GPA<1.75 and ([cAttempt]>=31 and [cAttempt]<=45)
'GPA<=2 and ([cAttempt]>=46)
Select Case creditAttempt
Case Is <= 15
If GPA < 1 Then
warnOrTerminate = "Terminate (1.0)"
ElseIf GPA < 1.5 Then
warnOrTerminate = "Warning (1.5)"
End If
Case 16 To 30
If GPA < 1.5 Then
warnOrTerminate = "Terminate (1.5)"
ElseIf GPA < 1.9 Then
warnOrTerminate = "Warning (1.9)"
End If
Case 31 To 45
If GPA < 1.75 Then
warnOrTerminate = "Terminate (1.75)"
ElseIf GPA < 2.2 Then
warnOrTerminate = "Warning (2.2)"
End If
Case Is >= 46
If GPA < 2 Then
warnOrTerminate = "Terminate (2.0)"
ElseIf GPA < 2.4 Then
warnOrTerminate = "Warning (2.4)"
End If
End Select
Everything works fine - but the field that shows the end user to either warn or terminate the student shows up very delayed. Any thoughts or ideas on speeding this up??
View 4 Replies
View Related