Wrox Programmer Forums
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2007, 06:53 PM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default New Programmer

I have been asked to learn Access for work. I have never done any programming and have three "Dummies" books. But, I am so confused.
My boss has been giving me challenges. I think I understand most of what I am supposed to be doing, but I can not figure this one out.
I have been asked to write a report showing some customers that live in CA and to sort them by order numbers. I was told to do this with code using the "DoCmd.RunSQL" command. So I tried this:
Dim mSQL As String

mSQL = "SELECT Name, State, Orders _
FROM Customers _
WHERE state = "CA" _
ORDER BY Orders _

DoCmd.RunSQL mSQL

Then I found out the I cannot use the SELECT command, because it doesn't return a value. So, how would I write the coding to open a form with just the above information using the "DoCmd.RunSQL" command? Or am I supposed to be using a Recordset instead? Any help I can get would be very helpful.

 
Old July 24th, 2007, 08:18 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I am not an ACCESS/VBA guy and you might want to move this to an Access forum but this post might help you:

http://www.databasejournal.com/featu...le.php/3505836

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old July 28th, 2007, 10:48 AM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your help. I am sorry I was in the wrong place. Thanks again for your help.

 
Old September 2nd, 2007, 02:30 PM
Registered User
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Misty

This seems like a really simple query to run in Access just using the SQL, rather than using the VBA to run the SQL.

Create the query in the Design View - Close all the tables and then click on the Design View button - it should drop down to SQL (if that isn't default) Then type in your query:-

SELECT Name, State, Orders
FROM Customers
WHERE state = "CA"
ORDER BY Orders {ASC |DESC};

ASC for ascending DESC for descending. Save it and name it. Either click on the red bang ! or run it from your query menu.

The Dummies book about Access isn't the best. If you like SQL, Bagui and Earl have a nice little book called "Learning SQL through Access". Equally, Gavin Powell's "Beginning Database Design" does exactly what it says on the label. Check out the Utter Access forum.






Similar Threads
Thread Thread Starter Forum Replies Last Post
VC++ Programmer mayank_moon2001 C++ Programming 0 October 5th, 2006 12:36 AM
Being a C++ programmer michaelbao C++ Programming 0 September 23rd, 2006 07:07 PM
Programmer Needed $$ amcdowell C# 0 March 31st, 2006 05:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.