Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange behaviour on changing data source

Status
Not open for further replies.

Robbo1974

Technical User
Jun 1, 2001
151
GB
Hi all,

I have a form for which I change the data source on the fly using command buttons. One of the fields on the form is named [company] which unsurprisingly contains a company name.

The original data source for the form is a table ([tblContactInformation]). The command buttons change this to various queries, one of which is named qryRhinosPlayerSponsors2002. The queries restrict the number of records shown to a particular set as you would expect.

I have a line in both the form's unload and close events which changes the data source back to [tblContactInformation] as well as a command button which I can use to do the same thing on the fly.

Recently, on opening the form I am given an 'enter parameter value' box requesting qryRhinosPlayerSponsors2002.Company for no apparent reason. This field does not appear in the form field list in design view and is not referenced anywhere else. So why is this happening? I'm stumped.

Thanks in advance, Iain

Robbo ;-)
 
it's possibly looking for the 'company' field in the qryRhinosPlayerSponsors2002.

If this field is on the form, check that it's in this query as well, otherwise recreate the query from scratch.

(when i've had a sim problem i've re-setup the query and it's done the trick).
 
Hi Gazer44,

When I unload or close the form the data source is changed back to tblContactInformation. So whenever I open the form again the data source is still tblContactInformation - qryRhinosPlayerSponsors2002 shouldn't be involved anywhere. This is why I can't understand why it's asking for a parameter for it. In any case, the field [company] is in qryRhinosPlayerSponsors2002. Puzzling.

Importing all of the objects into a new db hasn't helped either. :-( Robbo ;-)
 
Yes a strange one, try re-setting up the query 'qryRhinosPlayerSponsors2002' from scratch and get rid of the original one.
 
Sorry gazer, I should have explained a bit more. First point of call was to look at the effect of a) removing qryPlayerSponsors2002 totally. b) rebuilding it, just in case and c) importing all of the objects into a new db. None of this changed anything.

This is because the problem lies with the form. For some reason, on loading it is looking for this value when it shouldn't be. It must have something to do with the command button changing the data source, because this is the only time that qryRhinosPlayerSponsors2002 is called from anywhere.

Any other ideas from anyone?

Iain :) Robbo ;-)
 
Try rebuilding the form from scratch, otherwise post your email address and I'll take a look at the d/base. see if i can spot anything!
 
I found a simpler solution in the end Gazer - I just put a line in the form's on open event changing the data source. Works a treat. Thanks for your help, Iain Robbo ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top