Wrox Programmer Forums
| 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 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 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-
 
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 :)
 
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-
 
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.
 
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-




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





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