Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jan 2002
    Location
    Oregon
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    no current record error (2002)

    I am working on a book database that has a subform (sfrmBookIndex) on a form (frmBooks). The subform shows the results of a query (qryBookIndex) based on the BookID of the form, the results are displayed in continuous datasheet mode. The subform has fields for chapter, chapter title, keywords, etc. The keyword field has a cmd button that opens a listbox of preferred keywords. When the update keywords button on the listbox is selected, a proceedure is run that forms a concatenated string of the the selected keywords and writes it to the keyword field of the appropriate record. This all works very well for existing records but when the user moves to a create a new entry in the book index, all fields work except the keyword field where a "no record exists" error occurs because I am trying to edit a record that doesn't exist yet. A work around is to not enter keywords until all chapters have been entered but there must be a better way. I tried Testing for end of file and using AddNew rather than Edit but so far I have only been able to generate a new record in the BookIndex Table that is not linked to the BookID on the main form.

    Is there some way to force a new record to be written after the first field on the form is filled rather than waiting until the user moves to a different record .

    Obviously I am a beginner at this and the terminology may not be correct - I hope my explanation gets the reason for the error accross.

    Thanks for any ideas on this problem.

    Bob Holmstr

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

    Re: no current record error (2002)

    Try adding this code to the beginning of the On Click event procedure for the Update Keywords button:

    If Me.Dirty Then
    RunCommand acCmdSaveRecord
    End If

  3. #3
    Lounger
    Join Date
    Jan 2002
    Location
    Oregon
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: no current record error (2002)

    Thanks Hans,

    When I insert the code in the beginning of the On Click event procedure for the Update Keywords button I get the following error :

    "You entered an expression that has an invalid reference to the property Dirty"

    The "update keywords" button is on the update keywords form that shows the lists of prefered keywords - not on the book index subform - is "Me" referring to the wrong form?

    Bob Holmstr

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

    Re: no current record error (2002)

    I don't understand the error, but anyhow: where do the keywords end up - in the table behind the main form or in the table behind the subform?

  5. #5
    Lounger
    Join Date
    Jan 2002
    Location
    Oregon
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: no current record error (2002)

    Hans,

    Thank you.

    The keywords end up in the table behind the subform.

    So, I put your code on the keyword button that opens the form with the list of keywords rather than on the button that closes the keyword form. So far it seems to be working.

    Thank you Hans!

    Bob Holmstr

Posting Permissions

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