Rabu, 02 April 2014

Re: Re : [ExcelVBA] Help me here Please !!

 


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 problem
And the description of fields composed in your access table
Because 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 code
IIF
You can afford thid kind of deormalized schema structure of tables
Because room seems not to be the problem at all
Hand => Have a nice day
more comprehensive like this other
ii => isn t it
@++SC




Ery







Envoyé 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.
 
Thanks
Satheesh Kumar S


__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)
----------------------------------
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