We help IT Professionals succeed at work.

Updating an open Subform with VBA

Sdeam
Sdeam asked
on
Medium Priority
283 Views
Last Modified: 2008-02-26
 I have a rather complex form which details information about a job.  The form has a subform which has multiple line items on it.  However there is also another form which is linked to each line of the subform.  The form and table relationships are as follos

  Main --- 1 to many --- Sub --- 1 to many --- details

  Main
  m1
    Sub s1
        s2
         Detail d1
                d2
                d3
        s3
        s4
  m2
    etc
     

  The detail form is simply a checklist of information with two fields ItemName (text) and Finished(checkbox).  The information on the detail form is sequential in the order that it will occur/ be checked off.  

  What I want to do is to update the line item that is on the subform related to the detail form.  When an item on the detail form is checked off I want a field on the subform to update to show the next item on the checklist.  
 
   What I have tried to do so far is to open a recordset to the correct information that would be shown in the subform, change the information in the recordset, and then requery the suform.  When I do this I get a message saying that I need to save the current field.  I have tried inserting the command to save but it does not seem to make a difference.  If I update the recordset without trying to do a requery the information will be correct but not showing.  The field will update when I leave the current record butI will get a notice of a write conflict and be prompted to save.  I would like to be able to update the information on the subform and show the updated information immedietely when it changes.
Comment
Watch Question

Hi Sdeam,

Did you try requering the subform after the UnCheck was made?

In the CheckBox's AfterUpdate Event, place code like the following:

   Forms![YourMainFormNameHere]!Controls![YourSubFormNameHere].Requery

Hope this helps,

Nosterdamus

Author

Commented:
 I have tried to do the requery but I get an error saying that I need to save the current field.
Hi Sdeam,

Make sure that you requery at the AfterUpdate event and not in the BeforeUpdate event...

Nosterdamus
Hi SBeam,

Any progress???

Nosterdamus
Sdeam:

You have several open questions:

http://www.experts-exchange.com/jsp/qShow.jsp?qid=20130749
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20143486
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20161014
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20194767

To assist you in your cleanup, I'm providing the following guidelines:

1.  Stay active in your questions and provide feedback whenever possible. Likewise, when feedback has not been provided by the experts, commenting again makes them receive an email notification, and they may provide you with further information. Experts have no other method of searching for questions in which they have commented, except manually.

2.  Award points by hitting the Accept Comment As Answer button located above and to the left of that expert's comment.

3.  When grading, be sure to read:
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3
to ensure that you understand the grading system here at EE. If you grade less than an A, you must explain why.

4.  Questions that were not helpful to you should be PAQ'd (stored in the database for their valuable content?even if not valuable to you) or deleted. To PAQ or delete a question, you must first post your intent in that question to make the experts aware. Then, if no experts object after three full days, you can post a zero-point question at community support to request deletion or PAQ. Please include the link(s) to the question(s).
CS:  http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
At that point, a moderator can refund your points and PAQ or delete the question for you. The delete button does not work.

5.  If you fail to respond to this cleanup request, I must report you to the Community Support Administrator for further action.

Our intent is to get the questions cleaned up, and not to embarrass or shame anyone. If you have any questions or need further assistance at all, feel free to ask me in this question or post a zero-point question at CS. We are very happy to help you in this task!


thanks!
amp
community support moderator

1/21
sdeam: Please read #3 again!

thanks!
amp
community support moderator

Explore More ContentExplore courses, solutions, and other research materials related to this topic.