Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 9th, 2004, 02:55 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access VBA - SQL question.

In the book "Beginning Access 2000 SQL" (Great book so far btw) I'm hitting a snag.

In chapter 8 we are dynamically building SQL statements. The value assigned to the SELECT statement is always prefixed with "s."

ie:

strSELECT = "s.tblSales" or strSELECT = "S.*"

Why is it prefixed?

Any help is appreciated,

Thanks


-Raelz-
Reply With Quote
  #2 (permalink)  
Old February 10th, 2004, 06:32 AM
Ben Ben is offline
Authorized User
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The table would have been defined as s, this saves on both typing and typing mistakes :)
Reply With Quote
  #3 (permalink)  
Old February 10th, 2004, 11:45 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As in, using a dim state to declare s to be a table?

-Raelz-
Reply With Quote
  #4 (permalink)  
Old February 10th, 2004, 04:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Oxford, , United Kingdom.
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Raelz

It's what's known as an alias in SQL.

The full SQL statement would be something like this:

SELECT s.fldCost
FROM tblSales s

The bit in bold is saying; wherever you see 's' in the query replace it with tblSales.

As Ben says it reduces the amount of typing you have to do. Personnally, I never(*) use them as it reduces the readability of the query.

*Well, not quite never! Sometimes you have to use them to make the query work - for example if you need to bring the same table into a query more than once


Brian Skelton
Braxis Computer Services Ltd.
Reply With Quote
  #5 (permalink)  
Old February 10th, 2004, 11:28 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah, Thanks to both of you, really cleared that bit up.

-Raelz-
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on Access 2003 VBA Chapter 5 AlexJChang BOOK: Beginning Access 2003 VBA 1 June 7th, 2005 02:04 PM
Question on Access 2003 VBA - Ch5ExampleCode AlexJChang Access 2 June 3rd, 2005 11:10 AM
Access VBA Question vrocrider Access 3 March 4th, 2005 02:24 PM
ADODB sql in Access VBA rjp Access 2 August 25th, 2004 07:27 PM
Access SQL/VBA help danielwajnberg Access 4 September 2nd, 2003 06:56 PM



All times are GMT -4. The time now is 06:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.