Dim dtDay1 As Date
Dim dtDay2 As Date
Dim dtDay3 As Date
'once working I'll load these variables from a multi listbox.
dtDay1 = #7/22/2007#
dtDay2 = #7/24/2007#
dtDay3 = #7/25/2007#
This works:
DoCmd.OpenRepor t "frmTest", acViewPreview, , "[Weekend_Date] = " & "#"
& dtDay1 & "#"
This does not work:
DoCmd.OpenRepor t "frmTest", acViewPreview, , "[Weekend_Date] = " & "#"
& dtDay1 & "#" Or "[Weekend_Date] = " & "#" & dtDay2 & "#" Or
"[Weekend_Date] = " & "#" & dtDay3 & "#"
I get a type mismatch error but I think its poor syntax in the Where
Clause. Probably the quotes againnnnnnnn.
RICK 4 1398
On Wed, 18 Jul 2007 13:31:37 -0700, 2D Rick <rb*******@comp userve.com>
wrote:
The WHERE argument needs to be a single string.
-Tom.
>Dim dtDay1 As Date Dim dtDay2 As Date Dim dtDay3 As Date
'once working I'll load these variables from a multi listbox. dtDay1 = #7/22/2007# dtDay2 = #7/24/2007# dtDay3 = #7/25/2007#
This works: DoCmd.OpenRepo rt "frmTest", acViewPreview, , "[Weekend_Date] = " & "#" & dtDay1 & "#"
This does not work: DoCmd.OpenRepo rt "frmTest", acViewPreview, , "[Weekend_Date] = " & "#" & dtDay1 & "#" Or "[Weekend_Date] = " & "#" & dtDay2 & "#" Or "[Weekend_Date] = " & "#" & dtDay3 & "#"
I get a type mismatch error but I think its poor syntax in the Where Clause. Probably the quotes againnnnnnnn.
RICK
Simple answer: use IN in your criteria clause...it will look something like
this:
DoCmd.OpenRepor t "frmTest", acViewPreview, , "[Weekend_Date] IN (#" & dtDay1
& "#, #" & dtDay2 & "#,#" & dtDay3 & "#)"
But if you're using values from a listbox, you're probably wasting your time
trying to assign them to variables. What if the user only chooses one date?
Or chooses five? It's probably better to build the criteria clause
dynamically as you loop through the ItemsSelected collection of the list
box.
*air code*
strCriteria = "[Weekend_Date] IN (#"
With Me.lstMyDates
For each varItem in .ItemsSelected
strCriteria = strCriteria & CStr(.Column(0, varItem)) & "#,#"
' above assumes date is the bound listbox column - adjust as
necessary
Next varItem
End With
strCriteria = Left$(strCriter ia, Len(strCriteria )-2)
DoCmd.OpenRepor t "frmTest", acViewPreview, , strCriteria
"Tom van Stiphout" <no************ *@cox.netwrote in message
news:fk******** *************** *********@4ax.c om...
On Wed, 18 Jul 2007 13:31:37 -0700, 2D Rick <rb*******@comp userve.com>
wrote:
The WHERE argument needs to be a single string.
-Tom.
>>Dim dtDay1 As Date Dim dtDay2 As Date Dim dtDay3 As Date
'once working I'll load these variables from a multi listbox. dtDay1 = #7/22/2007# dtDay2 = #7/24/2007# dtDay3 = #7/25/2007#
This works: DoCmd.OpenRep ort "frmTest", acViewPreview, , "[Weekend_Date] = " & "#" & dtDay1 & "#"
This does not work: DoCmd.OpenRep ort "frmTest", acViewPreview, , "[Weekend_Date] = " & "#" & dtDay1 & "#" Or "[Weekend_Date] = " & "#" & dtDay2 & "#" Or "[Weekend_Date] = " & "#" & dtDay3 & "#"
I get a type mismatch error but I think its poor syntax in the Where Clause. Probably the quotes againnnnnnnn.
RICK
You just got your quotes fuzzulated:
DoCmd.OpenRepor t "frmTest", acViewPreview, , "(([Weekend_Date] = #"
& dtDay1 & "#) OR ([Weekend_Date] = #" & dtDay2 & "#) OR
([Weekend_Date] = #" & dtDay3 & "#))"
remember that what you are doing is wrapping the text strings around
the values contained in your variables...
btw...I like parenthethezez. ..
Ron, King of Chi
On Jul 18, 3:31 pm, 2D Rick <rbrown...@comp userve.comwrote :
Dim dtDay1 As Date
Dim dtDay2 As Date
Dim dtDay3 As Date
'once working I'll load these variables from a multi listbox.
dtDay1 = #7/22/2007#
dtDay2 = #7/24/2007#
dtDay3 = #7/25/2007#
This works:
DoCmd.OpenRepor t "frmTest", acViewPreview, , "[Weekend_Date] = " & "#"
& dtDay1 & "#"
This does not work:
DoCmd.OpenRepor t "frmTest", acViewPreview, , "[Weekend_Date] = " & "#"
& dtDay1 & "#" Or "[Weekend_Date] = " & "#" & dtDay2 & "#" Or
"[Weekend_Date] = " & "#" & dtDay3 & "#"
I get a type mismatch error but I think its poor syntax in the Where
Clause. Probably the quotes againnnnnnnn.
RICK
Great solution! I kept forgetting about the 'IN' and have any times
scratched my head thinking how am I going to do this...... :)
bobh.
On Jul 19, 1:42 am, "RMCEU1" <robemce...@hot mail.comwrote:
Simple answer: use IN in your criteria clause...it will look something like
this:
DoCmd.OpenRepor t "frmTest", acViewPreview, , "[Weekend_Date] IN (#" & dtDay1
& "#, #" & dtDay2 & "#,#" & dtDay3 & "#)"
But if you're using values from a listbox, you're probably wasting your time
trying to assign them to variables. What if the user only chooses one date?
Or chooses five? It's probably better to build the criteria clause
dynamically as you loop through the ItemsSelected collection of the list
box.
*air code*
strCriteria = "[Weekend_Date] IN (#"
With Me.lstMyDates
For each varItem in .ItemsSelected
strCriteria = strCriteria & CStr(.Column(0, varItem)) & "#,#"
' above assumes date is the bound listbox column - adjust as
necessary
Next varItem
End With
strCriteria = Left$(strCriter ia, Len(strCriteria )-2)
DoCmd.OpenRepor t "frmTest", acViewPreview, , strCriteria
"Tom van Stiphout" <no.spam.tom7.. .@cox.netwrote in messagenews:fk* *************** *************** *@4ax.com...
On Wed, 18 Jul 2007 13:31:37 -0700, 2D Rick <rbrown...@comp userve.com>
wrote:
The WHERE argument needs to be a single string.
-Tom.
>Dim dtDay1 As Date Dim dtDay2 As Date Dim dtDay3 As Date
>'once working I'll load these variables from a multi listbox. dtDay1 = #7/22/2007# dtDay2 = #7/24/2007# dtDay3 = #7/25/2007#
>This works: DoCmd.OpenRepo rt "frmTest", acViewPreview, , "[Weekend_Date] = " & "#" & dtDay1 & "#"
>This does not work: DoCmd.OpenRepo rt "frmTest", acViewPreview, , "[Weekend_Date] = " & "#" & dtDay1 & "#" Or "[Weekend_Date] = " & "#" & dtDay2 & "#" Or "[Weekend_Date] = " & "#" & dtDay3 & "#"
>I get a type mismatch error but I think its poor syntax in the Where Clause. Probably the quotes againnnnnnnn.
>RICK- Hide quoted text -
- Show quoted text -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Blah Blah |
last post by:
i just thought i'd shoot out a quick email on problems i've been having with
utf-8 in moving from 4.1.0 to 4.1.1. (please note that because i am using
UTF-8 as my default character set, i compiled from source rather than using
a premade binary)
i know that i'm working with alpha software - this is more of a
warning/sharing of knowledge than a complaint.
BASIC ISSUE: i am unable to use UTF-8 with mysql 4.1.1 and connector/j
3.0.9.
|
by: saracen44 |
last post by:
Hi
I have MyISAM tables
When I'm deleting parent I want to delete children in the same time.
How can I do It? What are possibilities?
Thanks
|
by: John Rivers |
last post by:
hi, here is how to do it and restore sanity to aspx html rendering:
(please only reply with sensible architectural discussion - juan)
put this at the end of an aspx file (or use an include at the end
if you want to reuse it on many aspx pages)
(notice closing brace)
(start)
<%}
|
by: Alan Foxmore |
last post by:
Hi everyone,
I'm new to C# and I was hoping I could get some clarification on the
syntax for jagged and multidimensional arrays.
Here is my question:
The following syntax is correct for declaring a multi-dimensional
array:
|
by: Terry C. |
last post by:
I have a bit of code that loops through a listbox and creates a string of
multiple selections and then passes that string to a SQL statement. However,
I cannot seem to get a handle on the proper syntax for the WHERE clause to
properly pass the string in the format of 'X' OR 'Y' to the query's criteria
field. Can someone clarify this syntax or point me to a good example of
using a varible string in the WHERE clause of a SQL statement?...
| |
by: Olly |
last post by:
Hello Everyone!
Could someone please have a look at my JS Form I posted
below....Something wrong there, but I don't understand what's exactly.
Many thanks.
Olly
===============================
<script language="JavaScript">
|
by: Bruce W. Darby |
last post by:
This will be my very first VB.Net application and it's pretty simple. But
I've got a snag in my syntax somewhere. Was hoping that someone could point
me in the right direction.
The history:
My work involves creating custom packages of our software product for golf
courses that purchase our software. The course data is kept as a back up in
the event the course needs us to replace their custom files. Each course has
a folder of it's own...
|
by: animatix |
last post by:
this is how far i have gotten.
<pathtoslides>www.animatix.us/slides/multi/VAR PIC</pathtoslides>
<pathtoproj> pop up path to fullproj, syntax flash to trigger embedded javascript to load new window. www.animatix.us/proj/multi/VAR PROJ
<slide01>
<who>estee lauder</who>
<detail>global merchandising conference : design + development</detail>
|
by: BruceWho |
last post by:
I downloaded boost1.35.0 and built it with following command:
bjam --toolset=msvc-7.1 --variant=release --threading=multi --
link=shared --with-system stage
and it failed to compile, error message is:
E:\software\development\boost_1_35_0\boost_1_35_0>bjam --
toolset=msvc-7.1 --variant=release --threading=multi --link=shared --
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |