Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 basic sql query help

Author  Topic 

amitbadgi
Starting Member

29 Posts

Posted - 2005-07-08 : 16:16:22
Hi guys, thanks everyone for your previous reply, they were immensly helpful. Now I have created a form in access where in a BID is entered, and teh search button is clicked on, and the corresponding details of teh BID is shown. The BID can be from any of the 4 different cities that I have in my access database. Now my first question is that once i click search the output is shown in a different page in a datasheet view, and I want the result on the form itself, how do i do it?.
Secondly once the result is shown, i want click on teh result which would open up another form with all the possible details of that record. So i am not sure as to hwo to proceed, here is the query that i had written and attached as a macro to my search button in my form

SELECT OneWorld.bus_id, OneWorld.bus_nam, OneWorld.bus_add, OneWorld.city, OneWorld.state, OneWorld.zip, OneWorld.phone
FROM [Select bus_id, bus_name as bus_nam, adrs1 as bus_add, city, state, zip, phone from dbo_businessNC
UNION ALL Select bus_id, bus_name as bus_nam, bus_add, city, state, zip, phone from Hawaccsumm
]. AS OneWorld
WHERE (((OneWorld.bus_id)=[Forms].[Form1].[Text2])) OR (((OneWorld.bus_nam)=[Forms].[Form1].[Text5])) OR (((OneWorld.bus_add)=[Forms].[Form1].[Text8])) OR (((OneWorld.phone)=[Forms].[Form1].[Text10])) OR (((OneWorld.zip)=[Forms].[Form1].[Text15]));

There are various other fields in the database tables for each city which i want to show up once I click on teh result that I get by running teh above query.
Thanks in advance

SMerrill
Posting Yak Master

206 Posts

Posted - 2005-09-09 : 14:55:14
It would be unfair to do this in an Access Macro. I would highly advise you do this in VBA code behind form.
I would make an unbound form with the search fields on it, then the search_click event can bind the form to the query you have made. This will provide a record-selector for you to browse through all the records that match the query. (However, the records will not be editable because you are using UNION.)

~ Shaun Merrill
Seattle, WA
Go to Top of Page
   

- Advertisement -