Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help

Help

Scheduled Pinned Locked Moved Visual Basic
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I am trying to get a number that will start at (2 digit month, 2 digit year (not visible) and 3 digit sequence number) that will automatically reset to 001 when the month changes. The number needs reference a table and go off the last number used. I have not been having any luck with it :banghead: any suggestions? Private Sub cmd1_Click() Set localConnection = CurrentDb() Set rJN = localConnection.OpenRecordset("TEST") rJN.MoveLast Dim cMonth As Integer Dim cYear As Integer Dim vYear As Integer Dim vMonth As Integer Dim vNum As Integer vYear = Int(Val(Left$(rJN![Test], 2))) vMonth = Int(Val(Mid$(rJN![Test], 2))) vNum = Int(Val(Right$(rJN![Test], 3))) cYear = Year(Now) cMonth = Month(Now) If vMonth = cMonth Then rJN = rJN + 1 Else rJN = "001" End If End Sub :help: Thanks

    N 1 Reply Last reply
    0
    • A Anonymous

      I am trying to get a number that will start at (2 digit month, 2 digit year (not visible) and 3 digit sequence number) that will automatically reset to 001 when the month changes. The number needs reference a table and go off the last number used. I have not been having any luck with it :banghead: any suggestions? Private Sub cmd1_Click() Set localConnection = CurrentDb() Set rJN = localConnection.OpenRecordset("TEST") rJN.MoveLast Dim cMonth As Integer Dim cYear As Integer Dim vYear As Integer Dim vMonth As Integer Dim vNum As Integer vYear = Int(Val(Left$(rJN![Test], 2))) vMonth = Int(Val(Mid$(rJN![Test], 2))) vNum = Int(Val(Right$(rJN![Test], 3))) cYear = Year(Now) cMonth = Month(Now) If vMonth = cMonth Then rJN = rJN + 1 Else rJN = "001" End If End Sub :help: Thanks

      N Offline
      N Offline
      NetPointerIN
      wrote on last edited by
      #2

      Set localConnection = CurrentDb() Set rJN = localConnection.OpenRecordset("TEST") rJN.MoveLast dim dtRS as Date = rJN![Test] If dtRS.Month = Now.Month Then dtRS.Month = dtRS.Month + 1 Else dtRS.Month = "01" End If debug.writeline (dtRS.ToString) Have not tested this...but may be this is what u want... Regards, NetPointer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups