Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No current record (Ms Access 2007)

    In the Before_Update of a control "txtArtnr" on my subfrmOrders i have the following code:
    ...
    If IsNull(Me!txtArtnr) Or Me!txtArtnr = "" Then
    MsgBox ("You must enter a Articlecode")
    DoCmd.CancelEvent
    Exit Sub
    Else
    code = DLookup("[Artnr]", "[tblOrderdetails]", "[Artnr] = Forms!frmOrders!subfrmOrders.Form!txtArtnr AND [Order_ID] = Forms!frmOrders!subfrmOrders.Form![Order_ID] ")
    If code = Me!txtArtnr Then
    Beep
    MsgBox "The artclecode is already used in one of the orderitems, and may only be used once.",
    DoCmd.CancelEvent
    SendKeys "{Esc 2}"
    Me.Parent!CmdClose.Enabled = False
    Else
    MsgBox (" de code is " & code)
    Stock = Nz(DLookup("[Voorraad]", "[tblArtikelen]", "[Artnr] = Me!txtArtnr"), 0)
    MsgBox ("de stock bedraagt " & CStr(Stock))
    MinStock = Nz(DLookup("[Bestelpunt]", "[tblArtikelen]", "[Artnr] = txtArtnr"), 0)
    If Stock <= MinStock Then ...
    Ps Code is declared as a string
    ...
    This code checks first of all the presence of a textvalue in the control., if not so a message comes up.
    After that it looks up all orderitems of the current order, to be sure that the article isn't already used in on of the orderitems.
    When i go to changing one of the orderitems, and i put as articlecode ,one that is already used, i get a message telling me that the code has been used already.
    So far, so good.
    If i put in a other articlecode i get the error "No current record". Because there as no accordance with the first IF, the code should normaly has to start with the code right after the Else.
    There, as you can see i have liberatly put a message statement in order to see if the code gets there. The message is not shown. The error message comes up immediatly
    How does this is possible ?

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: No current record (Ms Access 2007)

    Do you get the option to debug when the error message occurs? If so, which line is highlighted when you click Debug?

  4. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: No current record (Ms Access 2007)

    I only see the message with two buttons a) OK Help

  5. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: No current record (Ms Access 2007)

    That makes it difficult to guess what could cause the error message. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  6. #5
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: No current record (Ms Access 2007)

    As i"m going on voyage for the moment, i'll send you a stripped down copy begin of june.
    Thanks for the help
    Jacques

Posting Permissions

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