473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Loading a form triggers Query

6
I'm trying to create a master form that links to my other forms, when I click the button to set focus on one of my other forms it runs the query to populate my listbox. Its a listbox thats bound to a query but I don't want it to run, is there anyway to get it to NOT populate the list?

It doesn't try to run when I open that form directly only when I use SetFocus on my master form, why is it doing this and is there anyway to stop it?
May 3 '07 #1
6 1659
Rabbit
12,516 Expert Mod 8TB
Where is this listbox located and what's the code behind the button?
May 3 '07 #2
clcole
6
ok I have two forms

frmMaster

frmAdd

frmMaster has a button cmdAdd that has the following code

Private Sub cmdAdd_Click()
Form_frmAdd.SetFocus
End Sub

the listbox itself is on frmAdd and seems to want to populate as soon as that form gets the focus.
May 3 '07 #3
Rabbit
12,516 Expert Mod 8TB
ok I have two forms

frmMaster

frmAdd

frmMaster has a button cmdAdd that has the following code

Private Sub cmdAdd_Click()
Form_frmAdd.SetFocus
End Sub

the listbox itself is on frmAdd and seems to want to populate as soon as that form gets the focus.
Why is it a problem if it runs the query to populate?

I suppose you could set it's row source to an empty string and then set it back when you actually want it to populate.
May 3 '07 #4
clcole
6
The query actually pulls data from a combobox in the same form, its usually the afterupdate of that box that triggers the query. That being said to populate this list requires something entered into that combobox and since the form has just loaded there's nothing there and it pops up a dialog box asking for the contents of the combobox.
May 3 '07 #5
Rabbit
12,516 Expert Mod 8TB
Then just set the row source to nothing until you need it.
May 3 '07 #6
NeoPa
32,556 Expert Mod 16PB
As he says, don't design the query into the control itself. Simply update the RecordSource of the control in the event procedures that trigger it being required. EG. The AfterUpdate event of the ComboBox that it depends on.

Let us know how you get on :)
May 5 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: bmoos1 | last post by:
I have a form that when the monthly payment is entered, it calculates the annual payment. The correct numbers appear in the form, but they are not in the table or query from which the form was...
5
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
2
by: Juan Jose Costello Levien | last post by:
Hello, I am trying to use a trigger function I wrote in C. Basically what I want to do is to audit a table when a row is inserted into another table by copying the row to the new table. It...
0
by: cefrancke | last post by:
I have a datagrid on a windows form with a bindingnavigator. The tableadapter, bindingsource and dataset are there also. I can browse and edit data normally. I had added the "click" event to...
2
by: cefrancke | last post by:
I have a datagrid on a windows form with a bindingnavigator. The tableadapter, bindingsource and dataset are there also. I can browse and edit data normally. I had added the "click" event...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
4
by: BerkshireGuy | last post by:
Is there an event that triggers as a form is loading? I want to display a "loading form" event as the form is loading since it tends to take 20 second or so to open. TIA Brian
3
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent...
6
by: aaronkmar | last post by:
Trying to get a loading image to spin while the query is loading. I can get the data div to fade in, but I can't seem to figure out how to get the gif while the query is loading. I'm using two...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.