Thanks, Derek :)
Regards,
Satheesh Kumar S
On Wednesday, 2 April 2014 10:43 PM, Derek Turner <g4swy@yahoo.com> wrote:
This does not have to be complicated. We do not need to see the schema.
Sub MakeDynamicSQL()
Const SQL As String = "select * from YourAccessTable"
Dim sWhereClause As String
Select Case Cells(1, 1).Text ' cell A1 contains Y or N
Case "Y": sWhereClause = " where Med_D = 'Y'"
Case "N": sWhereClause = " where Med_D in ('Y','N')"
Case Else: MsgBox "error": Exit Sub
End Select
Debug.Print SQL & sWhereClause ' send this to Access
End Sub
Best Regards
Derek Turner
England
+++
From: "cauvin_stephane@yahoo.fr" <cauvin_stephane@yahoo.fr>
To: ExcelVBA@yahoogroups.com
Sent: Wednesday, 2 April 2014, 14:40
Subject: Re : [ExcelVBA] Help me here Please !!
Hello ,Better to send us the sql query code associated with your problemAnd the description of fields composed in your access tableBecause somethins don t match => in this case test to add a new fied
Containing the same data to join y and y instead of your difficult mapping in codeIIFYou can afford thid kind of deormalized schema structure of tables
Because room seems not to be the problem at allHand => Have a nice daymore comprehensive like this otherii => isn t it@++SCEryEnvoyé depuis Yahoo Mail pour Android
From: Satheesh Kumar <satheesh_it47@yahoo.com>;
To: <ExcelVBA@yahoogroups.com>;
Subject: [ExcelVBA] Help me here Please !!
Sent: Wed, Apr 2, 2014 10:50:35 AM
Hi Everyone,In My project, we connecting to MS Access from MS Excel, in excel we have one dropdown (medd) with Yes or No values. At the same time, in MS Access, we have column Med_D with Y or N values.So, if the user selects 'Yes' from the dropdown, then it should fetch the MS Access rows where Med_D = Y. If the user selects 'No' from the dropdown, then it should fetch the MS Access rows where Med_D in ('Y','N').I want to check this condition in a single query, we cant use CASE in Access, tried IIF & Switch but I got failed.ThanksSatheesh Kumar S
__._,_.___
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (6) |
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
.
__,_._,___
Tidak ada komentar:
Posting Komentar