Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    In the attached file is my db. I counted only 27 instances of Form_ needing to be converted to Forms!. You said there were 30. I must have missed at least 3 instances. Please point them out.
    Also, if I converted one that was not supposed to be converted please let me know about that also.



    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed
    Attached Files Attached Files

  2. #17
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    In post #4 you showed me two lines of executable code; They are:

    DoCmd.OpenForm "frmAddPersonnel"
    DoCmd.Close acForm, "frmPersonnel"

    I think that be must be a converse to these statements.

    After they are executed, then we have frmAddPersonnel open and frmPersonel closed.

    You just cannot leave it there. No Way.

    The frmPersonnel must be open when it is requeried and then it must be closed.

    Also, frmAddPersonnel is open, it is the second of the executable statements above and frmAddPersonnel must then be closed.

    Is this the correct way to do this?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

    I want to requery,

  3. #18
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Lou_Reed View Post
    In post #4 you showed me two lines of executable code; They are:

    Code:
    DoCmd.OpenForm "frmAddPersonnel"
    DoCmd.Close acForm, "frmPersonnel"
    <snip>
    I opened the attached dB from your Post #1 "Division_Dashboard_3.zip".
    When the dB is opened, the form "DivisionDashboard" opens.
    Clicking on the button "Personnel Management" opens form "frmPersonnel". (Form "DivisionDashboard" stays open.)
    Clicking on the button "ADD" executes the above two lines of code. (Form "frmPersonnel" is closed.... form "DivisionDashboard" stays open.)
    Aren't these your lines of code?


    Quote Originally Posted by Lou_Reed View Post
    <snip> I think that be must be a converse to these statements. <snip>
    I don't understand this....



    Quote Originally Posted by Lou_Reed View Post
    <snip> After they are executed, then we have frmAddPersonnel open and frmPersonel closed.

    You just cannot leave it there. No Way.<snip>
    ???????


    Quote Originally Posted by Lou_Reed View Post
    <snip>The frmPersonnel must be open when it is requeried and then it must be closed. <snip>
    OK. But why requery "frmPersonnel" if the next step is to close "frmPersonnel"?? What is the point?
    Since "frmPersonnel" is closed, when you open the form again, it is requeried. Don't need the requery line. Doesn't hurt, but is not necessary.....



    Quote Originally Posted by Lou_Reed View Post
    <snip> Is this the correct way to do this? <snip>
    This is a very difficult question. "Correct" is relative... if something works, you could consider it "correct".
    Are things in your dB correct for me? I would have to answer No - it is not the way I would do it. And there are lots of things that I would consider incorrect..... for me. But if you are ok with the results, then I would have to say, it is correct.

  4. #19
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    The line in he code (which by the way was not written by me) was:

    Forms1!Personnel.Requry.

    it originally was defined this way:

    Form_Personnel.Requery

    I did not write this line, someone else did. I did believe that it is a good idea to requery the frmPeresonnel at this point. I cannot be sure as I said I did not write the line. I only changed it to what you see on the first line. entry.

    Now as far as the lines of code:

    DoCmd.OpenForm "frmAddPersonnel"
    DoCmd.Close acForm, "frmPersonnel"

    are concerned again, I did not write them.

    When I saw them on your post, it was my thought that you were giving a me a hint as to what I should do next.

    They were written by someone else before I got the project.

    All I was saying was that executing these line leaves a few loose ends therefore the converse must be made. I did not mean anything else.

    I take it from what you said that you believe the last line of the Sub that requeries frmPersonnel is not needed.

    When to requery and when not to requery is not something that I am sophisticated at right now. I take anyone else's reasonable
    suggestion. If the last executable line in the Sub is to requery, then the form must be opened. If it is opened then it must be closed after the requery is finished.

    That is all my question is about.

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  5. #20
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I did some checking and the lines of code;

    DoCmd.OpenForm "frmAddPersonnel"
    DoCmd.Close acForm, "frmPersonnel"

    are associated with an ADD button on the larger form the second form. The Sub for them is only two, nothing more.

    I am not sure why this add button is there since it seems that all of the personnel adding is done on the previous form.

    Again, as I say at the end of the Sub when you requery a from as you say it must be open.


    Respectfully,

    Lou Reed

  6. #21
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    You say here:

    Code:
    A side note: on form "frmAddPersonnel", the tab order of the controls is messed up....:(
    That the tab order is messed up. How is it messed up. Is the sequence incorrect?

    Any help appreciated.

    Thanks in advance.

    Respectfully,

    Lou Reed

  7. #22
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Just my opinion.....

    Did you try tabbing through the fields?

    Starts out on Last name
    to First name
    to Preferred
    jumps to Organization
    then to the Add button (I do not include buttons in my tab orders)
    the Done button
    back to email
    to Branch
    to Branchhead

  8. #23
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    No, I am unfamiliar with tabs in MS Access 2010 so I thought you would tell me. I will try just straight tabbing and see if it is messed up.

    Respectfully,

    Lou Reed

  9. #24
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    So the final executable line in frmPersonnel's VBA code:

    Code:
    Form_frmPersonnel.Requery
    should be deleted then?

    There is no need to reopen and re query it since it will be re queried when it is opened again. Also, you cannot re query a
    a closed form which is its current state.

    Any help appreciated. hanks in advance.

    Respectfully,

    Lou Reed

  10. #25
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    YOU get to decide what happens.

    Lets start with "frmPersonnel".
    With "frmPersonnel" open, there is a button with the caption "Add", Clicking the button executes code: currently the code is
    Code:
        DoCmd.OpenForm "frmAddPersonnel"
        DoCmd.Close acForm, "frmPersonnel"
    The first line opens another form. You have to open this form to add new personnel.

    The second line closes the open form "frmPersonnel".
    But you have some options: you can close the form or leave it open.
    If you leave the form "frmPersonnel" open, you have two options: leave the form visible or hide the form.

    You get to decide what you want to happen........

    If you decide to leave "frmPersonnel" open and hide it (not visible), then you can requery "frmPersonnel" after you add personnel and click the ADD button on form "frmAddPersonnel".


    I think someone needs to sit down and decide how to navigate through all of the forms. Right now, clicking on the "Personnel Management" button opens the form "frmPersonnel", leaving "DivisionDashboard" open/visible.
    Clicking on the ADD button on "frmPersonnel" opens "frmAddPersonnel" and CLOSES "frmPersonnel". But "frmAddPersonnel" is hidden behind "DivisionDashboard".
    Closing "frmAddPersonnel" leaves you at "DivisionDashboard". that is ok if that is where you want to be. I would think you would want to be back at "frmPersonnel".


    And back to the requery...... again, this is the wrong syntax:
    Code:
    Form_frmPersonnel.Requery
    Should be
    Code:
    Forms!frmPersonnel.Requery
    If you decide to close "frmPersonnel", then the requery line should be deleted/commented out.
    If the form is left open, whether hidden or visible, then the requery command should be left in the code.


    I rarely use the Modal or Pop up properties. I think forms management is much better. If there is only one form visible, users have to interact with only that form.

  11. #26
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    When I open frmPersonnel in the attached db and start working on it, and I want to open frmEmail I get a dialogue
    box that says txtemailaddtress. I have been here before, but never had it work on this form.

    I just want frmEmail to open, not this dialogue box.

    What is going on and how do I fix it?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed
    Attached Files Attached Files

  12. #27
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Wait, I have this. The form was not opening due to an additional condition that was in the macro to open frmEmail. When took that out it worked fine.

    Thanks for your input.

    Respectfully,

    Lou Reed

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 04-06-2017, 02:26 PM
  2. Replies: 8
    Last Post: 12-12-2013, 03:54 PM
  3. No More Than 4 Employees Allowed on Form
    By burrina in forum Access
    Replies: 1
    Last Post: 10-25-2012, 10:54 PM
  4. Replies: 2
    Last Post: 04-16-2012, 12:56 PM
  5. Trouble adding data with forms
    By chuck130 in forum Forms
    Replies: 3
    Last Post: 09-02-2010, 09:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums