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

    RunTime Error 3075 in my query

    This is a very complex query for me, here is the sql code for it. It is used to calculate the Fica,Medicare,Fit and totals. It also has a module.
    Here also is code form my Module Named ModDate.

    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
    Function FIT()
    FIT = DLookup("FITMul", "TFIT", "FITMulDate = #" & DMax("FITMulDate", "TFIT", "FITMulDate <=DteEnd()") & "#")
    FIT_Exit:
    Exit Function
    FIT_Error:
    MsgBox "Unexpected error - " & err.Number & vbCrLf & vbCrLf & Error$, vbExclamation, "Function FIT()"
    Resume FIT_Exit
    End Function
    Function Med()
    Med = DLookup("MedMul", "TMed", "MedMulDate = #" & DMax("MedMulDate", "TMed", "MedMulDate <=DteEnd()") & "#")
    Med_Exit:
    Exit Function
    Med_Error:
    MsgBox "Unexpected error - " & err.Number & vbCrLf & vbCrLf & Error$, vbExclamation, "Function Med()"
    Resume Med_Exit
    End Function
    Function OT() '12/9/03 This should be deleted as it does not work correctly.
    OT = DLookup("OTRate", "TOTRate", "OTRateDate = #" & DMax("OTRateDate", "TOTRate", "OTRateDate <=DteEnd()") & "#")
    OT_Exit:
    Exit Function
    OT_Error:
    MsgBox "Unexpected error - " & err.Number & vbCrLf & vbCrLf & Error$, vbExclamation, "Function OT()"
    Resume OT_Exit
    End Function
    Attached Thumbnails Attached Thumbnails QueryError3075.png  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What is DteEnd()? A custom function? Concatenate variables.


    DLookup("FicaMul", "TFica", "FicaMulDate = #" & DMax("FicaMulDate", "TFica", "FicaMulDate <=#" & DteEnd() & "#")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Dte1 = Forms!frmAutoPayrollReport!StartDate
    Dte2 = Forms!frmAutoPayrollReport!EndDat

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    How does that relate to DteEnd()?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    That is used on the main form where everything launches from. It is also in my module as well.
    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

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Then concatenate the function as shown in my earlier post.

    Neither of those functions sets the values of Dte1 and Dte2. How are Dte1 and Dte2 populated?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

    Code runs from Main Form and Module and Queries

    Maybe this will help. A bit confusing I'm sure. Code is called from the ModDate and the query seeks it out as well.
    DTE1 and DTE2 are set by using the Calendar on the form frmAutoPayrollReport. Whatever dates you out in there is the criteria.default is one year back as start date and date() as End Date.
    Attached Thumbnails Attached Thumbnails ModuleModDate.jpg   frmAutoPayrollReport.png  

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Okay, Dte1 and Dte2 are public variables for that module but I still don't see procedure that populates them.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

    Attached db with Mod

    Year(DteEnd()) in one of my queries. QDates
    Dte1 = Forms!frmAutoPayrollReport!BeginDate from frmAutoPayrollReport
    Dte2 = Forms!frmAutoPayrollReport!EndDate
    Forms![frmAutoPayrollReport]![StartDate] = SelectDate.Value from Calendar form.
    Forms![frmAutoPayrollReport]![BeginDate] = CDate([AnyDate]) - (Weekday(CDate([AnyDate]))) - 2
    Forms![frmAutoPayrollReport]![EndDate] = CDate([AnyDate]) - (Weekday(CDate([AnyDate]))) + 4

    Hope this helps.
    Attached Files Attached Files

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Just confirms my previous comment. Dte1 and Dte2 are not populated by any procedure in that general module. Unless they are populated in a form module, the function calls will certainly fail. The variables must be populated before the functions are called.
    Last edited by June7; 01-07-2013 at 09:38 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Dte1 = Forms!frmAutoPayrollReport!StartDate As usual, Thanks Anyway!
    Dte2 = Forms!frmAutoPayrollReport!EndDat
    Call LookUp

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

Similar Threads

  1. runtime error 3075
    By Compufreak in forum Access
    Replies: 3
    Last Post: 08-14-2012, 01:40 AM
  2. RunTime error 3075
    By Compufreak in forum Access
    Replies: 3
    Last Post: 07-25-2012, 02:18 AM
  3. Runtime Error 3075 - Access 2010
    By cwturner2 in forum Programming
    Replies: 5
    Last Post: 06-29-2012, 04:03 PM
  4. RunTime Error 3075, code for search button
    By jacie in forum Programming
    Replies: 1
    Last Post: 04-15-2011, 05:23 AM
  5. Runtime 3075 error
    By whm1 in forum Programming
    Replies: 4
    Last Post: 03-24-2010, 02:50 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