Results 1 to 4 of 4
  1. #1
    mkc80 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    56

    Comparison Query

    I have a problem with my query. It was working fine until I added the 'Type Of Bill' Criteria.


    Site and Patient are character columns, Admit Date is of date format and Type Of Bill is a numeric column.

    I get the following error now: Application defined or object defined error.


    If IsNull(DMax("Line_Number", "DummyDetail", "[Site]= '" & Parent!Site.Value & "' AND [Patient] = '" & Parent!Patient.Value & "' AND [Type_of_Bill] = " & Parent!Type_of_Bill.Value & " AND [Admit_Date] = #" & Parent!Admit_Date.Value & "#"))
    Then Line_Number.Value = 1

    (these statements are in the beforeinsert event of the form, which is bound to the DummyDetail table)

    Line Number is a column in DummyDetail table, which needs to be reset to 1 if the bill type doesn't already exist in the table (for that particular site, patient and admit date)

    Please advise.

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Bill type - is it [Type of Bill] (with spaces) or [Type_of_Bill] (with underscores) in the table Dummydetail and the Parent form? That's the only thing I can think of that might be causing the error.

    John

  3. #3
    mkc80 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    56
    It is Type of Bill with spaces.

  4. #4
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    OK, there's your problem then. In your code, you need to refer to it as [Type of Bill], with spaces, not underscores, and in square brackets. Your statement then becomes:

    If IsNull(DMax("Line_Number", "DummyDetail", "[Site]= '" & Parent!Site.Value & "' AND [Patient] = '" & Parent!Patient.Value & "' AND [Type of Bill] = " & Parent![Type of Bill].Value & " AND [Admit_Date] = #" & Parent!Admit_Date.Value & "#"))
    Then Line_Number.Value = 1


    John

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

Similar Threads

  1. Comparison
    By raytackettsells in forum Queries
    Replies: 2
    Last Post: 08-06-2012, 05:30 PM
  2. Values comparison
    By Rekha V in forum Access
    Replies: 10
    Last Post: 03-24-2012, 10:29 PM
  3. Help: Comparison query to find non-matches
    By 14erclimber in forum Queries
    Replies: 6
    Last Post: 06-09-2010, 09:29 AM
  4. Comparison
    By VICTOR HUGO in forum Access
    Replies: 8
    Last Post: 02-10-2010, 04:32 PM
  5. Time Comparison
    By Larry819 in forum Queries
    Replies: 1
    Last Post: 06-22-2009, 09:26 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