Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using queries in sql 2005 in an Access adp database

Posted on 2008-06-16
6
Medium Priority
?
185 Views
Last Modified: 2013-12-05
I have tha attached query that works fine in SQL, however i want to be able to use this query in an ADP file, however im not sure how to do it. I think i would have to use a stored procedure, however im not sure how to use these that well.

Could any one give me some help in getting this to work please.
SELECT tblcustomerdetails.Auto, tblcustomerdetails.[Date Recorded], tblcustomerdetails.NAME, tblcustomerdetails.[Trading As Name], tblcustomerdetails.SalesPerson, tblcustomerdetails.[Internal Status], tblterminaldetails.TID, tblterminaldetails.MID, tblmerchantinfo.[Previous Acq]
FROM ((tblcustomerdetails LEFT JOIN tblterminaldetails ON tblcustomerdetails.Auto = tblterminaldetails.Auto) LEFT JOIN tblratesandfees ON tblcustomerdetails.Auto = tblratesandfees.Auto) LEFT JOIN tblmerchantinfo ON tblcustomerdetails.Auto = tblmerchantinfo.Auto;

Open in new window

0
Comment
Question by:CaptainGiblets
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:orcic
ID: 21792229
You can create a view and use it in Access same way as you would a table.

create view v_tblcustomerdetails
 as
SELECT tblcustomerdetails.Auto, tblcustomerdetails.[Date Recorded], tblcustomerdetails.NAME, tblcustomerdetails.[Trading As Name], tblcustomerdetails.SalesPerson, tblcustomerdetails.[Internal Status], tblterminaldetails.TID, tblterminaldetails.MID, tblmerchantinfo.[Previous Acq]
FROM tblcustomerdetails LEFT JOIN tblterminaldetails ON tblcustomerdetails.Auto = tblterminaldetails
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 21792344
ive created the view, however when i change data on one of the tables that populate the vie, will the view automatically be updated? or would i have to run something to get it to do that?
0
 
LVL 7

Expert Comment

by:orcic
ID: 21792387
view is actually a saved and compiled select statement so it will always show actual data from the related tables.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 6

Author Comment

by:CaptainGiblets
ID: 21792464
sorry just one more question. I think the name makes it obvious but ill ask anyway.

As it is only a view i take it it is read only? If you have a form bound to a view you cant change the data on it?
0
 
LVL 7

Accepted Solution

by:
orcic earned 2000 total points
ID: 21792968
It depends...
It is possible to make a view that would be updatable, but you have to follow certain rules.
http://msdn.microsoft.com/en-us/library/ms180800.aspx
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 21793118
The answer to your question depends on what you actually want to do with your query. In Access, the query is usually feeding the data to a form or report. If so, then all you need to do is specify your query as record source for the form or report, and it will work. There's no need to create a view or stored procedure, unless your query is very, very large (about 20 times larger than yours) and Access fails to interpret it - then you create the view to help Access.

Even if you need to only work with the query results directly, it's still good idea to create a form (wizard will create it for you in no time), rather than create view and open it from Access. Access will work much faster with the form than with the view, especially when the database has many objects.

Finally, the data being editable or read-only does not depend on whether it's a view or direct query; it mainly depends on all participating tables having primary keys, and those primary keys included in the query. Further, if it's a form, you can specify the unique table you are going to edit - if you open the view directly, Access won't know, so the same multi-table query may be read-only when opened as a view, and editable in the form.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question