Results 1 to 3 of 3

Thread: DMax (k2)

  1. #1
    New Lounger
    Join Date
    Dec 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DMax (k2)

    When I execute the fallowing sub program, I got this message ( Run-time error '3464':
    Data type mismatch in criteria expression. )

    Private Sub Budget_year_Exit(Cancel As Integer)
    Dim pet

    pet = DMax("Sequence_number", "BOND", "Budget_year = " & Me!Budget_year & " AND COUNTY_NUMBER = " & Me!County_number & " AND Subdistrict_number = " & Me!Subdistrict_number & " AND LG_ID= " & Me!LG_ID)

    Sequence_number.Value = pet + 1

    End Sub

    Bond table :
    LG_ID TEXT
    Budget_year NUMBER
    COUNTY_NUMBER NUMBER
    Subdistrict_number NUMBER

    Thanks for help

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DMax (k2)

    Some remarks:
    1. <LI>If pet is to be numeric, declare it as

      Dim pet As Long

      <LI>You state that LG_ID is a text field. You must put quotes around the value you use as criteria for a text field:

      ... AND LG_ID= " & Chr(34) & Me!LG_ID & Chr(34))

      Chr(34) is tthe double quote character ".

      <LI>You are doing a DMax on a field "Sequence_number" but you don't mention a field of that name in your table.

  3. #3
    New Lounger
    Join Date
    Dec 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DMax (k2)

    Thanks for help. I put quotes around the Lg_id and its work. thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •