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

    Code Error on Subform.Cant find table or query?


    Here is the error;
    The Microsoft Jet database engine cannot find the input table or query 'OrdersPaymentSub'. Make sure it exists and that its name is spelled correctly.
    I have a subform named as above on the main form named Add an Order and Details.It is where I enter payments for the Order and then they are applied to the Order Amount Due.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Domain aggregate functions (DSum, DCount, DLookup, etc.) cannot refer to a form or report as data source. They must refer to table or query for data. Also, variables must be concatenated into the argument. Reference to form control is a variable. You have spaces in names. They must be included and the name enclosed in [].
    This expression DSum("Payment", "OrdersPaymentSub", "OrderID=Forms!AddanOrderandDetails!OrderID") doesn't make sense. Payment field is not in Orders table and OrderID is not in TPaymentSub.

    I don't see a common id field that links these two tables. How are these tables related?

    Have you run Debug>Compile?
    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 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Thanks for taking the time to look at it. I have just fixed the problem. I did a complete rewrite of the db. Now, just a little more testing and it is ready to go. If you get time I could use some help with a multi If statement or at least what direction to take.

    Right now I am using 4 different textboxes and making them visible or not. Status is hidden on form,limited to list.

    Private Sub Form_Current()

    If txtOrderTotal > 0 Then 'Balance is Due textbox that says Balance is Due
    txtowed1.Visible = True
    Else
    txtowed1.Visible = False
    End If

    If txtOrderTotal < 0 Then 'Overpaid, Credit is Due textbox that says Credit is Due
    txtowed2.Visible = True
    Else
    txtowed2.Visible = False
    End If

    If txtOrderTotal = 0 Then 'Paid in Full textbox that says Paid in Full
    txtowed3.Visible = True
    Else
    txtowed3.Visible = False
    End If

    If txtOrderTotal = 0 Then ' Set Value to Paid in Full if Balance is Zero.Status is either Due or Paid in Full
    SetValue.Status = "Paid in Full"
    End If

    End Sub

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Don't see anything wrong with that code. Are you getting error or is not working right? Consider:

    Private Sub Form_Current()
    txtowed1.Visible = txtOrderTotal > 0
    txtowed2.Visible = txtOrderTotal > 0
    txtowed3.Visible = txtOrderTotal > 0
    If txtOrderTotal = 0 Then Me.Status = "Paid in Full"
    End Sub
    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.

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

Similar Threads

  1. Replies: 12
    Last Post: 09-14-2012, 04:59 PM
  2. Compile Error: Can't find out what's wrong with the code.
    By vickan240sx in forum Programming
    Replies: 4
    Last Post: 05-24-2012, 06:25 PM
  3. Replies: 1
    Last Post: 10-12-2011, 08:07 AM
  4. Find and Replace query from a 2nd table
    By elightbox in forum Queries
    Replies: 1
    Last Post: 09-17-2010, 05:37 PM
  5. Replies: 1
    Last Post: 11-30-2009, 05:05 AM

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