Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Trouble Using " and '

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin - 23 May 2007 02:34 GMT
I need help in using the proper double quotation in a defined text string.
This code is based in a previous response on limiting content of one combo
box from what's selected in a another combo box. I already made one combo box
work on a simple query, but here I got some complexity since I need to add an
expression in my limited knowledge on using single and double quotations is
not helping my find the correct way to write it.

Dim strSQL1 as String

strSQL1 = "SELECT [Unit-State].Unit, [Unit-State].State FROM [Unit-State]"
strSQL1 = strSQL1 & " WHERE ((([Unit-State].State)=IIf(" & Me![GasTypeCode]
strSQL1 = strSQL1 & "=Vac Or " & Me![Combo1]
strSQL1 = strSQL1 & "=PVac,PV,P))) ORDER BY [Unit-State].Unit;"
Me!Combo1.RowSource = strSQL1

I want to limit that whenever Me!Combo1 is "Vac" or "PVac", my query
criteria is filtered by "PV", otherwise my query criteria should be filtered
by "P"

Thanks.
Ken Snell (MVP) - 23 May 2007 04:18 GMT
Dim strSQL1 as String, strIf As String
If Me![GasTypeCode] = "Vac" Or Me![GasTypeCode] = "PVac" Then
   strIf = "PV"
Else
   strIf = "P"
End If
strSQL1 = "SELECT [Unit-State].Unit, [Unit-State].State FROM [Unit-State]"
strSQL1 = strSQL1 & " WHERE [Unit-State].State='" & strIf & "'"
strSQL1 = strSQL1 & " ORDER BY [Unit-State].Unit;"
Me!Combo1.RowSource = strSQL1

Signature

       Ken Snell
<MS ACCESS MVP>

>I need help in using the proper double quotation in a defined text string.
> This code is based in a previous response on limiting content of one combo
[quoted text clipped - 21 lines]
>
> Thanks.
Martin - 23 May 2007 17:35 GMT
Brilliant!!

> Dim strSQL1 as String, strIf As String
> If Me![GasTypeCode] = "Vac" Or Me![GasTypeCode] = "PVac" Then
[quoted text clipped - 32 lines]
> >
> > Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.