Results 1 to 15 of 15

Thread: Idea is Needed To Calculate an Annual Leave

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Location
    Bahrain
    Posts
    306

    Re: Idea is Needed To Calculate an Annual Leave

    It means I have to calculate the fields not the Value which is in the text Box that displayed from the Field itself ??
    Current Project: General Employees Database (Employees Information) & (Training Details).

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Idea is Needed To Calculate an Annual Leave

    Could you explain more?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Location
    Bahrain
    Posts
    306

    Re: Idea is Needed To Calculate an Annual Leave

    Yes, What I mean to say. Is it possible calculating only the Objects rather than the DB Fields. I;E, In the First tab I have listed the all information for the employee inculding the Joining Date. Now, while the Joining Date is already assigned to an Object in the Form, is it possible to Calculate the Experiance from that Joining Date ? Not the Rs.Field("JoiningDate")

    Code:
    D = DateDiff("YYYY", Now, Me.txtJoiningDate.text)
    txtExperiance.Text = D
    What I want to know is once I calculated this Value, is it Possible to assign the Caluclated Field to Field in the Table ??

    Or I have only one chooise is only Calculate the Fields ?? To assign the Value in to them ?

    Many Thanks in advance,

    Habibalby
    Current Project: General Employees Database (Employees Information) & (Training Details).

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Idea is Needed To Calculate an Annual Leave

    Yes, you can calculate from the values in the textboxes instead of querying the db.
    Use something like this format...

    VB Code:
    1. Forms![Form1]![txtLeave].Value
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Location
    Bahrain
    Posts
    306

    Re: Idea is Needed To Calculate an Annual Leave

    Quote Originally Posted by RobDog888
    Yes, you can calculate from the values in the textboxes instead of querying the db.
    Use something like this format...

    VB Code:
    1. Forms![Form1]![txtLeave].Value

    Yes, I understood that it can be. But the Main Question is will it be possible to enter a Calculated Field into a Database Field ??

    Example:
    Code:
    Total = Val(Text1.Text) * Val(Text2.Text)
    Text3.Text = Total
    Now is it possible to enter the Total into a Database Field?

    Thanks Mate and Happy New Year.

    Habibalby
    Current Project: General Employees Database (Employees Information) & (Training Details).

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Idea is Needed To Calculate an Annual Leave

    Yes, but you can only go one way for a calculated value. If your calculating it
    from your ex. then you would have a field in the table that would take the
    Total value. If you are trying to take a calculated value and place it into two
    fields then you cant unless you have a formula to reverse engineer the values.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Location
    Bahrain
    Posts
    306

    Re: Idea is Needed To Calculate an Annual Leave

    Quote Originally Posted by RobDog888
    Yes, but you can only go one way for a calculated value. If your calculating it
    from your ex. then you would have a field in the table that would take the
    Total value. If you are trying to take a calculated value and place it into two
    fields then you cant unless you have a formula to reverse engineer the values.

    HTH

    From you experiance, what you choose if you were me. Calculating the field taken this method:
    Code:
    Rs.Open "Data",Conn, .............,..............., adCmdTable
    'Check for records returned
    If rs.bof = False and rs.eof = False Then
        oD = DateDiff("YYYY", Now, Rs.Field("JoiningDate").Value)
        If Rs.Field("Experiance).Value = 4 Then 
            rsleave.fields("LeaveEntitled").Value = 21
        Else
            rsleave.fields("LeaveEntitled").Value = 28
        End If
        rsleave.update
    Else
        msgbox "Error - no records returned!"
    End If
    
    If rs.state = adstateopen Then Rs.Close
    If rsleave.state = adstateopen Then RsLeave.Close
    Set rs = Nothing
    Set rsleave = Nothing
    or doring this example:

    Code:
    Total = Val(Text1.Text) * Val(Text2.Text)
    Text3.Text = Total
    Thanks for your gratest reply dude.

    Habibalby
    Current Project: General Employees Database (Employees Information) & (Training Details).

Posting Permissions

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



Click Here to Expand Forum to Full Width