[mso] Re: Access VBA SQL :VSMail mx2

  • From: James LaBorde <jlaborde@xxxxxxxxx>
  • To: "'mso@xxxxxxxxxxxxx'" <mso@xxxxxxxxxxxxx>
  • Date: Mon, 13 Oct 2003 10:00:15 -0700

Ray,

Not sure of how it would be used in the Excel sense of the word but since
you are using VBA, you can open the querydef if you have it in Access and
modify it.  If the fields are always the same but have different criteria,
you can write the querydef on the fly. 

Here is what I would do:

Dim strSQLRoot as string
Dim strSQLWhere as String
Dim strSQL as String
Dim QD as querydef
Set QD

strSQLRoot = Enter your query here without the where.

strSQLWhere = Create your where clause on the fly

strSQL = strSQLRoot & strSQLWhere

qd = strSQL


This will dynamically change your query from your code.

This is a very rudimentary look at it, if you want more detail just let me
know and I will gladly work with you on it.

James

-----Original Message-----
From: Ray Blake [mailto:ray@xxxxxxxxx]
Sent: Monday, October 13, 2003 9:40 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Access VBA SQL :VSMail mx2


Folks,

An odd one, this. I'm convinced I've done 90% of the hard work, but my
naivety of Access is letting me down at the final step. Here's what I've
done:

1. I have a form with a number of listboxes, allowing users to multiple
select from several filtering options.
2. I have a big VBA sub which looks at the selections in the listboxes
and writes part of an SQL string (basically, the 'WHERE' section), which
can be quite long!
3. I now want to use this as the criterion for an existing query, let's
call it 'qryFiltered' 

I just need to know how to accomplish part 3 of the operation. I'm using
Access 2000, and have no need to make it 97 compatible.

NB: Just reviewed this post and realise my use of the word 'Filter' may
confuse the issue - best to clarify that I mean it in the Excel sense of
the word.

TIA.

Ray
_____________

This email is from Ray Blake, Head of Software Design, GR Business
Process Solutions. It is confidential and intended for the addressee
only. The contents are private and may be legally privileged. If you
receive this email in error we would be grateful if you would advise the
sender and delete the email from your system.

For more information on the services that we offer please visit us at
our website: - www.grbps.com 



*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes)
in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also
allow you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation
with instructions.  Once you are a member of the files group, you can go
here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: