Between not working, please help

  • Thread starter Thread starter Gina Whipp
  • Start date Start date
G

Gina Whipp

DoCmd.OpenReport "rptHistoricalTime", acPreview, , Between " &
Me![cboStartWeek] & " And " & Me![cboEndWeek] & ""

I have tried to concate this thing ten ways from SUnday and can't get the
Between to work. The two fields are numeric. I have tried searching the
newsgroup and can't find anything to help me figure out what I am doing
wrong.

Thanks in advance!
Gina Whipp
 
You're missing a " character to left of Betwen, and you do not specify the
field that is to be filtered, and you don't need the trailing " character:

DoCmd.OpenReport "rptHistoricalTime", acPreview, , "[NameOfFieldGoesHere]
Between " & Me![cboStartWeek] & " And " & Me![cboEndWeek]
 
Gina said:
DoCmd.OpenReport "rptHistoricalTime", acPreview, , Between " &
Me![cboStartWeek] & " And " & Me![cboEndWeek] & ""

I have tried to concate this thing ten ways from SUnday and can't get
the Between to work. The two fields are numeric. I have tried
searching the newsgroup and can't find anything to help me figure out
what I am doing wrong.

Thanks in advance!
Gina Whipp

The syntax for BETWEEN is...

SomeValue Between ThisValue and ThatValue

You only have two out of the three required operands. WHAT is it that should be
between Me![cboStartWeek] And Me![cboEndWeek]? Assuming it is a field in the
report and that all three operands are dates then it should look like...

DoCmd.OpenReport "rptHistoricalTime", acPreview, , "SomeDateFieldName Between #"
& Me![cboStartWeek] & "# And #" & Me![cboEndWeek] & "#"
 
You know... hitting myself in the head ...that's the same mistake I did the
last time I tried to use Between. I keep forgetting that! Thanks Ken!

Ken Snell (MVP) said:
You're missing a " character to left of Betwen, and you do not specify the
field that is to be filtered, and you don't need the trailing " character:

DoCmd.OpenReport "rptHistoricalTime", acPreview, , "[NameOfFieldGoesHere]
Between " & Me![cboStartWeek] & " And " & Me![cboEndWeek]

--

Ken Snell
<MS ACCESS MVP>


Gina Whipp said:
DoCmd.OpenReport "rptHistoricalTime", acPreview, , Between " &
Me![cboStartWeek] & " And " & Me![cboEndWeek] & ""

I have tried to concate this thing ten ways from SUnday and can't get the
Between to work. The two fields are numeric. I have tried searching the
newsgroup and can't find anything to help me figure out what I am doing
wrong.

Thanks in advance!
Gina Whipp
 
Exactly what did you change your code to?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Gina Whipp said:
Now I'm getting expected End of Statement highlighting the word Between

Ken Snell (MVP) said:
You're missing a " character to left of Betwen, and you do not specify
the field that is to be filtered, and you don't need the trailing "
character:

DoCmd.OpenReport "rptHistoricalTime", acPreview, , "[NameOfFieldGoesHere]
Between " & Me![cboStartWeek] & " And " & Me![cboEndWeek]

--

Ken Snell
<MS ACCESS MVP>


Gina Whipp said:
DoCmd.OpenReport "rptHistoricalTime", acPreview, , Between " &
Me![cboStartWeek] & " And " & Me![cboEndWeek] & ""

I have tried to concate this thing ten ways from SUnday and can't get
the Between to work. The two fields are numeric. I have tried
searching the newsgroup and can't find anything to help me figure out
what I am doing wrong.

Thanks in advance!
Gina Whipp
 
Exactly what did you change your code to?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Gina Whipp said:
Now I'm getting expected End of Statement highlighting the word Between

Ken Snell (MVP) said:
You're missing a " character to left of Betwen, and you do not specify
the field that is to be filtered, and you don't need the trailing "
character:

DoCmd.OpenReport "rptHistoricalTime", acPreview, , "[NameOfFieldGoesHere]
Between " & Me![cboStartWeek] & " And " & Me![cboEndWeek]

--

Ken Snell
<MS ACCESS MVP>


Gina Whipp said:
DoCmd.OpenReport "rptHistoricalTime", acPreview, , Between " &
Me![cboStartWeek] & " And " & Me![cboEndWeek] & ""

I have tried to concate this thing ten ways from SUnday and can't get
the Between to work. The two fields are numeric. I have tried
searching the newsgroup and can't find anything to help me figure out
what I am doing wrong.

Thanks in advance!
Gina Whipp
 
Now I'm getting expected End of Statement highlighting the word Between

Ken Snell (MVP) said:
You're missing a " character to left of Betwen, and you do not specify the
field that is to be filtered, and you don't need the trailing " character:

DoCmd.OpenReport "rptHistoricalTime", acPreview, , "[NameOfFieldGoesHere]
Between " & Me![cboStartWeek] & " And " & Me![cboEndWeek]

--

Ken Snell
<MS ACCESS MVP>


Gina Whipp said:
DoCmd.OpenReport "rptHistoricalTime", acPreview, , Between " &
Me![cboStartWeek] & " And " & Me![cboEndWeek] & ""

I have tried to concate this thing ten ways from SUnday and can't get the
Between to work. The two fields are numeric. I have tried searching the
newsgroup and can't find anything to help me figure out what I am doing
wrong.

Thanks in advance!
Gina Whipp
 
I got it! Silly me, typo

Ken Snell (MVP) said:
You're missing a " character to left of Betwen, and you do not specify the
field that is to be filtered, and you don't need the trailing " character:

DoCmd.OpenReport "rptHistoricalTime", acPreview, , "[NameOfFieldGoesHere]
Between " & Me![cboStartWeek] & " And " & Me![cboEndWeek]

--

Ken Snell
<MS ACCESS MVP>


Gina Whipp said:
DoCmd.OpenReport "rptHistoricalTime", acPreview, , Between " &
Me![cboStartWeek] & " And " & Me![cboEndWeek] & ""

I have tried to concate this thing ten ways from SUnday and can't get the
Between to work. The two fields are numeric. I have tried searching the
newsgroup and can't find anything to help me figure out what I am doing
wrong.

Thanks in advance!
Gina Whipp
 
Back
Top