[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 554
  • Last Modified:

CInt not working

I can't seem to get this to evaluate the number in the combo box as a number.  The immediate window shows the number in the combo box as '8' and is only bringing up records that are 9 days old.  The other records 10 Days and older are not showing up.

s = s & " And [B2B EDGE].phase = 0" & _
    " And DateDiff('d', app_date, Now) < 500" & _
    " And DateDiff('d', app_date, Now) > '" & CInt(Forms!frmPhaseData2.cboDays) & "'" & _
    " And [B2B EDGE].Manager like '" & Nz(Me.cboManager, "*") & "'"
0
chrisamuel
Asked:
chrisamuel
1 Solution
 
peter57rCommented:
Hello chrisamuel,

You are speciftying the date difference must be Greater Than the combo value.
If you want to allow the combo value as well you should use >=


Pete.
0
 
Alan WarrenCommented:
Hi sean,

try using Val(Forms!frmPhaseData2.cboDays)

outputs:

 And [B2B EDGE].phase = 0 And DateDiff('d', app_date, Now) < 500 And DateDiff('d', app_date, Now) > 8 And [B2B EDGE].Manager like 'fred'


Alan
0
 
Alan WarrenCommented:
should return all records with app_date between 9 and 499 days old with phase = 0 and manger like 'Fred'
0
 
cws05Commented:
enclosing stuff in single quotes make access evaluate as text. Make sense?

Replace your code with this

s = s & " And [B2B EDGE].phase = 0" & _
    " And DateDiff('d', app_date, Now) < 500" & _
    " And DateDiff('d', app_date, Now) > " & CInt(Forms!frmPhaseData2.cboDays) &  _
    " And [B2B EDGE].Manager like '" & Nz(Me.cboManager, "*") & "'"

Chris
0
 
chrisamuelAuthor Commented:
Thanks! I'm glad it was a simple fix.

- Christine
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now