473,378 Members | 1,067 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,378 software developers and data experts.

Using SQL Query in Access

I have a feeling that this is a silly question. But pls excuse me as i am a newbie and i have been beating abt this issue for 2 days and i have not been to solve it.

I made a form with 1 combo box, 1 buttom and a Grid DTC.

Now, for example. Taking the scenario of a car showroom.
By choosing the name of a brand or Company(like Honda) in the combo box and clicking on the button. I want to display every model(like Civic, Accord) that is available from that brand.

I wrote the query to do it in Queries part of access. It is working fine. But i am unable to write that query in the VB window that pops up when i go to the Events in the property of button.

Pls guide me
Thanks
Nov 17 '06 #1
6 2720
NeoPa
32,556 Expert Mod 16PB
Please post in here what you have in the properties of the form for :
Record Source
Filter
Order by
Allow Filters

Also, if the record source is the name of a query, then post the SQL of that query (Design view of query then select SQL View from the View menu).
Nov 17 '06 #2
Tanis
143 100+
If it's working as a named query, why change it to SQL? DoCmd.OpenQuery "myquery" will work just as well.
Nov 17 '06 #3
NeoPa
32,556 Expert Mod 16PB
I wasn't suggesting that anyone change the query to SQL.
Merely to change the view of an existing query to show the embedded SQL in order to post it in here.
Nov 17 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
I have a feeling that this is a silly question. But pls excuse me as i am a newbie and i have been beating abt this issue for 2 days and i have not been to solve it.

I made a form with 1 combo box, 1 buttom and a Grid DTC.

Now, for example. Taking the scenario of a car showroom.
By choosing the name of a brand or Company(like Honda) in the combo box and clicking on the button. I want to display every model(like Civic, Accord) that is available from that brand.

I wrote the query to do it in Queries part of access. It is working fine. But i am unable to write that query in the VB window that pops up when i go to the Events in the property of button.

Pls guide me
Thanks
Further to what NeoPa said:

Can you supply the following ...

1. The name of the form. I assume the record source of the form is the aforementioned query. If you open the query in design view and then change the view to sql you can copy and paste the full sql statement here.
2. The system name of the combobox control and the row source of the combo box. This might just be a value list like "Honda";"Nissan";..etc.
Or it might be based on a sql query or a table.
3. The system name of the command button.
4. 'a Grid DTC' - are you talking about a datagrid or a subform in datasheet view?

With this information we can give you the VBA code to use in the button click event. Essentially the options are to set a filter or change the record source of the form dynamically. We will have a better idea which option to use if you can provide the above information.

Mary
Nov 17 '06 #5
First off, i am extremly sorry for thr delay in replying.
Grid DTC is a datagrid. I dragged it from the tool bar menu. i named the button "btnList"
The query in perfectly working. When i run it in the query section. BUt in the form, i dont know how to implement it.
If i select honda and click the button. I want the list of all the honda cars in the data grid
Nov 18 '06 #6
NeoPa
32,556 Expert Mod 16PB
Sreenadh,

Can you revisit my earlier post and find the information for us please.
Then we can start to look at this seriously. At the moment we're all a little in the dark.
Nov 18 '06 #7

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

Similar topics

1
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David...
7
by: Bob | last post by:
Currently I am using this statement to translate 3 fields in my db thru Visual Basic. I import the data from one table to another then call the IFF statements and the NewDate to translate the...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
16
by: Asaf | last post by:
I am trying to create and use a COM object with C#.NET 2005. The assembly is set to "Register for COM interop" but when I am trying to call it from VB on Word 2003 I am getting this error: ...
3
by: eagleofjade | last post by:
I am trying to help a friend who is learning VB.net in school. I have done VB programming for a number of years using VB 6. He needs to open a query in an Access database that has parameters so he...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
11
by: funky | last post by:
hello, I've got a big problem ad i'm not able to resolve it. We have a server running oracle 10g version 10.1.0. We usually use access as front end and connect database tables for data extraction....
0
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.