Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Date criteria with any day

Discussion in 'Information Technology' started by Garret, Jul 28, 2006.

Tags:
  1. Garret

    Garret
    Expand Collapse
    Guest

    Hello,

    I'm looking to open a report using a line of code like this:

    DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
    "tblGages.LastCalib = #" & Month & "/1/" & Year &
    "#"

    where Month and Year hold numeric values entered by the user. I have
    the "1" there right now as a temporary character. I'm looking to make
    it so the criteria uses that Month and Year value, but works for any
    day. I thought of some solutions but ran into the problem that some
    months have 29, some 30, some 31, days.

    Thanks for any help.
     
  2. Loading...


  3. schasteen

    schasteen
    Expand Collapse
    Guest

    DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
    "(Month(tblGages.LastCalib) = " & Month & "and
    year(tblGages.LastCalib) = & Year &")"



    "Garret" wrote:

    > Hello,
    >
    > I'm looking to open a report using a line of code like this:
    >
    > DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
    > "tblGages.LastCalib = #" & Month & "/1/" & Year &
    > "#"
    >
    > where Month and Year hold numeric values entered by the user. I have
    > the "1" there right now as a temporary character. I'm looking to make
    > it so the criteria uses that Month and Year value, but works for any
    > day. I thought of some solutions but ran into the problem that some
    > months have 29, some 30, some 31, days.
    >
    > Thanks for any help.
    >
    >
     
  4. Garret

    Garret
    Expand Collapse
    Guest

    Thanks, it was just what I wanted. I ended up using this statement:

    DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
    "(Month(tblGages.LastCalib) = " & Month & _
    "and Year(tblGages.LastCalib) = " & Year & ")"

    It turns out that you left out some quotation marks. Thanks bunches
    though!

    schasteen wrote:
    > DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
    > "(Month(tblGages.LastCalib) = " & Month & "and
    > year(tblGages.LastCalib) = & Year &")"
    >
     
  5. schasteen

    schasteen
    Expand Collapse
    Guest

    Sorry , sometimes my typing get ahead of my brain.

    "Garret" wrote:

    > Thanks, it was just what I wanted. I ended up using this statement:
    >
    > DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
    > "(Month(tblGages.LastCalib) = " & Month & _
    > "and Year(tblGages.LastCalib) = " & Year & ")"
    >
    > It turns out that you left out some quotation marks. Thanks bunches
    > though!
    >
    > schasteen wrote:
    > > DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
    > > "(Month(tblGages.LastCalib) = " & Month & "and
    > > year(tblGages.LastCalib) = & Year &")"
    > >

    >
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page