Results 1 to 4 of 4
  1. #1
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87

    variable returning 1990 for the year

    I have the following code where I am trying to get the first of the previous month. the variable StrtDt keeps coming up as 1/9/1990???

    Dim BillDt As Integer


    Dim CurDt As Integer
    Dim StrtDt As Date
    Dim EndDt As Date

    CurDt = Format(Date, "dd")
    If CurDt >= 16 And CurDt <= 31 Then
    BillDt = 1
    End If
    StrtDt = Date
    If BillDt = 1 Then
    StrtDt = Format(StrtDt, "mm") - 1
    StrtDt = StrtDt & "/1/" & Format(Date, "yyyy")
    End If

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you looked at the DateSerial() function?

  3. #3
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87

    Never what that one was for...

    It worked perfectly, after I drug out the programming book. Thanks, I have a new tool.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Thanks for posting back with your success.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Returning PK after append?
    By MikeMairangi in forum Database Design
    Replies: 5
    Last Post: 08-18-2011, 04:28 PM
  2. Replies: 0
    Last Post: 08-10-2011, 11:59 AM
  3. Object variable or With block variable not set
    By walter189 in forum Programming
    Replies: 1
    Last Post: 07-28-2011, 08:51 AM
  4. Replies: 4
    Last Post: 08-05-2010, 01:26 PM
  5. Refering to variable form names inside a variable
    By redpetfran in forum Programming
    Replies: 2
    Last Post: 05-21-2010, 01:39 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums