Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146

    Unanswered: What's wrong with this query?

    I have a table called "Classifieds" that contains a field called "InsertDate". An operator enters the date manually via a form. I'm creating a query that will tell me when 30 days has gone by from the InsertDate. I have tried the following query but it doesn't work:

    >=DateAdd("d",30,[InsertDate])

    I'm trying to query all records who are greater than or equal to 30 days past their InsertDate. If I manually enter a date in the place of [InsertDate], everything works just fine. Something tells me I'm not making a correct reference to the right field. Any ideas?

  2. #2
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by smacdonaldnc
    I have a table called "Classifieds" that contains a field called "InsertDate". An operator enters the date manually via a form. I'm creating a query that will tell me when 30 days has gone by from the InsertDate. I have tried the following query but it doesn't work:

    >=DateAdd("d",30,[InsertDate])

    I'm trying to query all records who are greater than or equal to 30 days past their InsertDate. If I manually enter a date in the place of [InsertDate], everything works just fine. Something tells me I'm not making a correct reference to the right field. Any ideas?
    Morning smacdonaldnc,

    Take a try and see if this works....it will give you a date 30 days back from the Insert Date. Is that what you were talking about?

    =DateAdd("d",-30,[InsertDate])

    The above will place that in a TextBox for you.
    However, if you have something like this.....
    CheckOutDate, CheckInDate, DueDate you will need 3 TextBoxes and this in the CheckInDate box:

    Code:
    Private Sub CheckInDate_AfterUpdate()
    
        If Me.CheckInDate > Me.CheckOutDate + 30 Then
        MsgBox ("This item is being returned late"), vbOKOnly, "LATE FEE DUE"
        End If
        Me.PurchaseDate.Requery
        
    End Sub
    Now, when you enter a date in the CheckInDate box, you will get a message that this item is Late....being late by 30 days at that.

    have a nice one,
    Bud

  3. #3
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146
    Quote Originally Posted by Bud
    Morning smacdonaldnc,

    Take a try and see if this works....it will give you a date 30 days back from the Insert Date. Is that what you were talking about?

    =DateAdd("d",-30,[InsertDate])

    The above will place that in a TextBox for you.
    However, if you have something like this.....
    CheckOutDate, CheckInDate, DueDate you will need 3 TextBoxes and this in the CheckInDate box:

    Code:
    Private Sub CheckInDate_AfterUpdate()
    
        If Me.CheckInDate > Me.CheckOutDate + 30 Then
        MsgBox ("This item is being returned late"), vbOKOnly, "LATE FEE DUE"
        End If
        Me.PurchaseDate.Requery
        
    End Sub
    Now, when you enter a date in the CheckInDate box, you will get a message that this item is Late....being late by 30 days at that.

    have a nice one,
    Bud
    The second example is very close to what I'm trying to accomplish. I have insert dates stored in a field and I'm trying to write a query thats attached to a command button. When the button is pushed, all records will be displayed in which 30 days has passed since the InsertDate, making the account Past Due.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •