Results 1 to 6 of 6
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Problem with Module for Payroll

    I have a db and my Payroll Module is giving me some problems. Here is the Module Code:
    Function Fica()


    Fica = DLookup("FicaMul", "TFica", "FicaMulDate = #" & DMax("FicaMulDate", "TFica", "FicaMulDate <=DteEnd()") & "#")
    Fica_Exit:
    Exit Function
    Fica_Error:
    MsgBox "Unexpected error - " & err.Number & vbCrLf & vbCrLf & Error$, vbExclamation, "Function Fica()"
    Resume Fica_Exit
    End Function

    The error message I get when I try to run my queries is; ' Syntax Error in Query QSaleComTotWkA, expression 'FicaMulDate = # #'.
    ' Reserved error 0
    Attached Thumbnails Attached Thumbnails ModDate.jpg  

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Perhaps something like this will work:
    Code:
    Function Fica()
    Fica = DLookup("FicaMul", "TFica", "FicaMulDate = #" & DMax("FicaMulDate", "TFica", "FicaMulDate <=#" & DteEnd() & "#") & "#")
    Fica_Exit:
    Exit Function
    Fica_Error:
    MsgBox "Unexpected error - " & err.Number & vbCrLf & vbCrLf & Error$, vbExclamation, "Function Fica()"
    Resume Fica_Exit
    End Function
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Further Explanation and Attached Database

    That did help some. I wrote this database over 12 years ago and have slept since then. It started out in Access 2.0 a long time ago in a place far away.
    Attached is a scaled down version of the database. If you dont mind and have the time, please look at it and see what you think may be causing the problem.
    Attached Files Attached Files

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    As far as I can see at the moment, the problem is that DteEnd() has no value.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I think you cut out too much....

    In the module "ModDate", how do the global variables "Dte1" & "Dte2" get initialized??

  6. #6
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    This comes from a form named frmAutoPayrollReport and it is set there. The date criteria can be removed for testing purposes.
    Dte1 = Forms!frmAutoPayrollReport!StartDate
    Dte2 = Forms!frmAutoPayrollReport!EndDat
    This code is from the module ModDate:
    Option Compare Database
    Option Explicit
    Public Dte1
    Public Dte2
    Public BilID As Variant
    Public CustmID
    Public QTBA As String 'Added 6/1/04 used to change recordsource for the RTimeBillingSub Report on the Main InvoiceReport.
    Function DteStart()
    DteStart = Dte1
    DteStart_Exit:
    Exit Function
    DteStart_Error:
    MsgBox "Unexpected error - " & err.Number & vbCrLf & vbCrLf & Error$, vbExclamation, "Function DteStart()"
    Resume DteStart_Exit
    End Function
    Function DteEnd()
    DteEnd = Dte2
    DteEnd_Exit:
    Exit Function
    DteEnd_Error:
    MsgBox "Unexpected error - " & err.Number & vbCrLf & vbCrLf & Error$, vbExclamation, "Function DteEnd()"
    Resume DteEnd_Exit
    End Function

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

Similar Threads

  1. Replies: 5
    Last Post: 09-06-2012, 04:32 PM
  2. Employee info in Payroll form
    By ismalee in forum Forms
    Replies: 4
    Last Post: 06-30-2012, 05:16 PM
  3. Module Problem
    By kwooten in forum Modules
    Replies: 9
    Last Post: 06-13-2012, 10:21 AM
  4. Module & dcount problem
    By gg80 in forum Modules
    Replies: 5
    Last Post: 01-20-2012, 07:12 PM
  5. Replies: 4
    Last Post: 05-16-2011, 04:58 PM

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