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. can someone tell me how to correct this

can someone tell me how to correct this

Scheduled Pinned Locked Moved Visual Basic
helpdebuggingtutorial
1 Posts 1 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.
  • M Offline
    M Offline
    Member 843064
    wrote on last edited by
    #1

    Public Sub CalcDaysWorked() Dim I, X As Integer For I = 41 To 1 Step -1 If (FrmCalendar.TxtDate(I).Text = "1") Or ((FrmCalendar.TxtDate(I).Text = "2") Or (FrmCalendar.TxtDate(I).Text = "3") Or _ (FrmCalendar.TxtDate(I).Text = "7")) Then FrmCalendar.TxtDaysWrkd.Text = (Val(X)) Exit Sub Else If FrmCalendar.TxtDate(I).Text = "W" Then X = (X + 1) Else If (FrmCalendar.TxtDate(I).Text <> "1") Or ((FrmCalendar.TxtDate(I).Text <> "2") Or _ (FrmCalendar.TxtDate(I).Text <> "3") Or (FrmCalendar.TxtDate(I).Text <> "7")) Then 'IGNORE IT I = (I - 1) End If End If End If Next I FrmCalendar.TxtDaysWrkd.Text = (Val(X)) FrmCalendar.TxtDaysWrkd.Refresh End Sub BAsically this is part of an employees attendance/work record it keeps track of points(1,2,3 or 7) days worked"w" and some misc info that need not be tracked for this calculation thus the I=I-1 'to ignore the entry I need to calculate the days worked (my w's) after the last occurance of an infraction(1,2,3 or 7) My code works 100% however i forsee an error if a "w" is enetered on the last day of the month This is because the x values is only calulating on ever other loop through the code The problem is in the above code..When I debug it it gets called on correctly everytime but the "x" value is not incrementing by 1 every time! Greg S

    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