Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automating Subform actions (2000)

    Hi,
    I've attached a database if needed. Also, I'm not really a programmer but getting better, so be gentle with programming terminology and the like. I have 2 problems with the form frmDPLEntryOnly. Problem 1 is with a subform. This form has 2 subforms. I have the 2 subforms synchronized, where when I move to a record on SF1, SF2 moves to the matching records. this works great. My problem is when I'm adding new records on SF1, it does not automatically go to a new record in SF2. Can this be done? Actually what I would prefer to happen is this: When I add a Component (sfrmComponentSubform) and hit the tab or enter key I'd like my cursor to go to a new record in the Parts Subform(sfrmComponent&PartsSubform), then if I have to add a new Component, I click on a button (add new component) and it will put my cursor back in the component new record and also Parts subform will go to a new record as well.

    Problem 2 is when I choose a JON (cboMachJON) from the main form, it used to fill in some of the fields (machinename, ID, Serial#), it no longer does that and I can't figure out why or what's different. I've been making some other changes and additions to the database, but didn't think I changed anything is these forms.

    Thanks,
    Deb
    Attached Files Attached Files

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Automating Subform actions (2000)

    I cannot open that form, it refers to a table tlbCarList which is not available.

  3. #3
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automating Subform actions (2000)

    Try This sorry.
    Attached Files Attached Files

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

    Re: Automating Subform actions (2000)

    About Problem 2: there is a unique index on lngMachineID in tblDPL. This makes the relationship between tblDPL and tblMachineInformation into a 1-to-1 relationship. To remedy this, do the following:

    - Delete the relationship between tblDPL and tblMachineInformation.
    - Open tblDPL in design view.
    - Delete the index on lngMachineID.
    - Close and save the design of tblDPL
    - Re-create the relationship between tblDPL and tblMachineInformation (and set Enforce Relational Integrity).

    Selecting a JON from the combo box on the DPL form should now update the Machine Name etc. automatically.

    Note: you have lots of automatically created indexes on your tables, among which duplicate indexes. Remove the duplicates, they only take up space. (If you like, you can remove all other indexes except for the primary keys.)

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

    Re: Automating Subform actions (2000)

    About Problem 1:

    Attached is a version with a different setup for the Parts subform; the link is through Master and Child Link fields instead of through code.

    I have added code to move from the Component text box to a new record on the Parts subform, but I haven't added a "New Component" button yet.
    Attached Files Attached Files

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Automating Subform actions (2000)

    Hans, you have also set the 1st subform's cycle property to Current Record which keeps the record you have just inserted as the active record in this subform.

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

    Re: Automating Subform actions (2000)

    Hmm, yes I did. Is that good or bad?

  8. #8
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Automating Subform actions (2000)

    It's good of course, since if you had not it would have left the 1st subform pointing to a new record with the cursor on the 2nd subform's new record, and if you continue that creates a problem in that the 2nd subform has no reference record in the 1st subform.

    Or are you just testing me here, hmmnn...

  9. #9
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Automating Subform actions (2000)

    Re the Button to add a new component, why not just use the button that is already provided by access on the components subform, this is the rightmost button of the 3 navigation buttons on the components subform.

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

    Re: Automating Subform actions (2000)

    There is a problem here that I didn't solve. If you click in the Component subform, focus is on the text box. If you then click the New Record button, the Component subform moves to a new record, but the On Exit event of the text box shifts focus to the Parts subform. You *must* click in the Component subform to enter something in the text box there before entering something in the Parts subform. Not user-friendly. Do you have a suggestion for that?

    (By the way, I deliberately set the Cycle property to Current record in the Component subform. I just wondered why you posted that comment. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>)

  11. #11
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Automating Subform actions (2000)

    >>There is a problem here that I didn't solve. If you click in the Component subform, focus is on the text box. If you then click the New Record button, the Component subform moves to a new record, but the On Exit event of the text box shifts focus to the Parts subform. You *must* click in the Component subform to enter something in the text box there before entering something in the Parts subform. Not user-friendly. Do you have a suggestion for that?<<

    This is a problem, perhaps using the OnExit event of the control is not the way to go. I tried to use the AfterInsert event to shift the focus to the Parts subform but the cursor remains fixed on the components subform. Is there a way in the AfterInsert event to redisplay the last record added in the components subform and then not use the CurrentRecord in the Cycle property?
    >>(By the way, I deliberately set the Cycle property to Current record in the Component subform. I just wondered why you posted that comment. )<<
    It was more for Deb's benefit.

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

    Re: Automating Subform actions (2000)

    I would keep the On Exit event of the text box, but with an extra check:

    Private Sub txtComponent_Exit(Cancel As Integer)
    If Me.NewRecord And Not IsNull(Me.txtComponent) Then
    RunCommand acCmdSaveRecord
    Me.Parent!sfrmPartsSubform.SetFocus
    End If
    End Sub

    Keep the Cycle property of the Component subform set to Current Record.

    The extra check means that the New Record button in the navigation buttons can be used. If Deb likes, she can create a command button too.

  13. #13
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Automating Subform actions (2000)

    What I couldn't understand was how your original wrote the component record where you had a set focus and a goto new record in the Exit event of the text field in the component subform.
    Your latest code sample makes a lot more sense, in that you first write the record away then set the focus to the parts subform.

    It would be nice if Access were to have another option in the cycle property or some other property to keep the record just added as the current record in the components subform and allow the cursor to be positioned at a new record in the parts subform. Still, your solution works well, and is user friendly as well.

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

    Re: Automating Subform actions (2000)

    Discussion with patt (thanks!) led to a better approach for Problem 1. See attached version.
    Attached Files Attached Files

  15. #15
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automating Subform actions (2000)

    I'd to create another button just because the people using this db aren't very literate and a button that says "ADD NEW COMPONENT" would make their life much easier. [img]/forums/images/smilies/smile.gif[/img]
    Deb

Page 1 of 3 123 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
  •