Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Run time error 2118 (2002)

    Ok, I've got another weird one. I'm trying to do a requery and am getting the message:

    Run-time error '2118':
    You must save the current field before you run the Requery action.

    I do the same thing in 3 other forms and don't get an error. I have no idea which 'field' I need to save before making the requery.

    Any hints as to what might be causing this would be greatly appreciated.

    Thanks in advance,

    Mary

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

    Re: Run time error 2118 (2002)

    Please post the code you're using (in an attachment if it's long) or post a stripped down copy of the database.

  3. #3
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    Here is the code. Data will follow. The error is generated when you do the following:

    Choose Registrant on the first form
    Enter a name that isn't in the list
    Fill in the information on the New Resident Screen - choose a company from the list and put a 5 in category
    Choose Print

    You will also get the error if you choose the Process Seminar Registration button but you have to go thru another form.

    Thanks again

  4. #4
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    Data

  5. #5
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    OOPs, I forgot 2 queries that New Registrants needs. I've put them with the data and am re-sending.

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

    Re: Run time error 2118 (2002)

    The New Registrant form is opened from the Print Registrant form in the On Not In List event of cmbRegistrant. When this happens, the value of cmbRegistrant has not been saved yet (since the value does not occur in the list). You can't requery the combo box while there is a "pending" value.

    However, you don't need to set the value of the combo box or requery it anyhow, since this can be handled by the On Not In List event procedure by setting

    Response = acDataErrAdded

    This tells Access that the new value has been added to the list.

  7. #7
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    If I add the Response=acDataErrAdded where you suggested and take out the requery; the error goes away but my new entry is not in the list when I return to the Print Registrants form. The correct name is in the combo box but it's not in the list. I have to requery for the app to work.

    I though the error was caused by the Process_Controlls subroutine. Even when I comment out the call, I still get the error.

    I'm still stumped.

    Thanks for the help.

    Mary

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

    Re: Run time error 2118 (2002)

    It works for me in the attached version - I did set the value of the combo box (because you use the LastFirst name, not the name entered by the user) but the combo box is not explicitly requeried.

  9. #9
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    First, I'd like to thank you for all your help.

    It's still now working correctly. As you said, the name is now in the list when I added all your modifications. However there are two problems occurring: when returning to the Print Registrant form the focus is not on the combo box and the print routine prints all blanks. I think the fact that the combo box does not have focus is causing the print report to print nothing since it prints from that combo box.

    Oh so close. Any other suggestions?

    Thanks,

    Mary

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

    Re: Run time error 2118 (2002)

    You're printing a report dependent on the combo box on the Print Registrant form before the value of that combo box has been saved. You should either remove the Print button from the New Registrant form, or make the button print a report based on the record you create in this form.

  11. #11
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    Yes, I'm using the value of the combo box as the basis of the print. I think you're telling me that there is no way to 'force' the combo box to have focus after I've reset the value. Once I return to it and click on the combo box, it has focus and print works.

    Thanks again,

    Mary

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

    Re: Run time error 2118 (2002)

    Whether the combo box has the focus or not is irrelevant.

    What I'm saying is that your print routine from the New Registrant form doesn't work the way you expect it to because while the New Registrant form is open, the combo box on the Print Registrant form hasn't been updated yet. So you must either forego printing from there (and make the button only return the user to the Print Registrant form), or you must set up the report differently. I repeat once more, your report is dependent on the combo box on the Print Registrant form. While the New Registrant form is open, this combo box does not yet contain the correct values. This only happens AFTER you close the New Registrant form, and set Response = acDataErrAdded in the On Not In List event of the combo box. Only then, the combo box is requeried and the new value set.

  13. #13
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    OK, I finally understand the process.

    This leads to something else I don't know how to do. If I change my report to use a query (which I'm in the midst of doing) then how do I set the prompt value of the query for the report? Here is the query:

    SELECT Registrants.FirstName, Registrants.LastName, Registrants.Short_Property, Registrants.Short_Company, Registrants.Category, Registrants.S1, Registrants.S2, Registrants.S3 FROM Registrants WHERE (((Registrants.ID)=[Enter ID:]));

    Here is how I'm calling the Print Report:

    DoCmd.OpenReport "IndPrint1"

    How do I set the value of the prompt? I know the syntax of the SQL statement but I don't know where or how to set it.

    Sorry to be so dense but I don't work with VBA apps very often (about once a year when I have to revist our Registration app). We're making extensive modifications this year and its taxing my little bit of knowledge.

    Thanks again,

    Mary

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

    Re: Run time error 2118 (2002)

    I'd set the Record Source of the report to the Registrants table instead of to a query, and specify a Where-condition in the instruction that opens the report:

    DoCmd.OpenReport ReportName:="IndPrint1", WhereCondition:="ID = " & ID

  15. #15
    Lounger
    Join Date
    Mar 2001
    Location
    Texas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run time error 2118 (2002)

    Ok, I have it all working. There is, of course, one other thing I'd like to do. When I return to the Print Registrants screen, I like for the combo box to have focus. It does if I come from any of the forms that are operating on a record that was chosen from the combo box before calling the other forms. The combo box does not have focus if a new record has been added. It shows the correct record in the combo box but the combo box does not have focus.

    Is it possible to do this? It would make it so much easier for my users if the combo box always had focus when they came to this screen.

    Thanks again for all your help,

    Mary

Page 1 of 2 12 LastLast

Posting Permissions

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