Results 1 to 5 of 5
  1. #1
    ChrisThomas99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    3

    PO Detail Subform Line Numbering Problem

    I'm pulling my hair out here I have a Purchase Order form the main form is from query from the PO header table and then a subform (for the line detail) from a query from the PO Detail table.
    I have the following code in the "Before Update" event to add an incremental line number to each of the individual PO Lines. I Have this code working fine in the Sales order part of the Database but for some reason the same code is not working here:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim strWhere As String
    strWhere = "PONumber = """ & Me.Parent!PONumber & """"
    Me!LineNumberID = Nz(DMax("LineNumberID", "tblPurchaseOrderDetail", strWhere), 0) + 1
    End Sub

    I'm getting the error: - Runtime error '3464' data Type Mismatch in criteria expression? I don't know why can anyone of you gurus help at all?

    The LineNumberID field in the table tblPurchaseOrderDetail is of data type Number - Long Integer

    The PONumber Field in both the Header and Detail Tables are again both defined as data type Number - Long Integer

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No delimiters for a numeric value:

    http://access.mvps.org/access/general/gen0018.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ChrisThomas99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    3
    Thanks for that, complete novice here, checked the link it makes sense, but not a clue where to put the apostrophe's, I tried a couple of ways but just getting various different errors? Sorry...

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    If PONumber is defined as a Number, the syntax would be

    strWhere = "PONumber = " & Me.Parent!PONumber

    If PONumber is defined as Text, the syntax would be

    strWhere = "PONumber = '" & Me.Parent!PONumber & "'"

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    ChrisThomas99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    3

    Thumbs up

    Quote Originally Posted by Missinglinq View Post
    If PONumber is defined as a Number, the syntax would be

    strWhere = "PONumber = " & Me.Parent!PONumber

    If PONumber is defined as Text, the syntax would be

    strWhere = "PONumber = '" & Me.Parent!PONumber & "'"

    Linq ;0)>

    Brilliant! works perfect, thanks so much - its easy when you know how hey!

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

Similar Threads

  1. Master/detail form problem....
    By dkperez in forum Forms
    Replies: 5
    Last Post: 04-01-2011, 04:28 PM
  2. Conditional calculations in the detail line
    By stupesek in forum Reports
    Replies: 10
    Last Post: 09-23-2010, 11:00 AM
  3. numbering line entries
    By tgavin in forum Access
    Replies: 6
    Last Post: 07-27-2010, 11:53 AM
  4. Multiple detail items per line
    By needafix in forum Reports
    Replies: 3
    Last Post: 10-22-2009, 11:04 AM
  5. Report Detail Entry Selection Problem
    By Joe in forum Reports
    Replies: 0
    Last Post: 02-02-2009, 06:55 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