Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    taya621 is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jan 2011
    Posts
    38

    Create append query to allow user to sign themselves up for project


    Hello,
    I am trying to create an append query (or if you have it, a better tool) to allow my users to views various prjoects and sign themselves up for projects they choose. Right now, I have a form in datasheet view with a subform that shows the employees currently assigned to the project (picture attached), is there a way to allow the user to sign themselves up for multiple projects. Also, I want to restrict editing any information on the project unless the logged in user is the creator. I do have a user login for my users so they won't be able to assign other people to projects but I wouldn't know how to make the append query detect that and only allow the login user to add their name. Thank you in advance!

  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    A simple append query looks like the following:

    Code:
    INSERT INTO T_ProjectEmployees ( fkProjID, fkEmpID )
    VALUES (2,3)
    This will insert a new record into the T_ProjectEmployees table and will set the fkProjID value to 2 and the fkEmpID value to 3 for that new record.

    To have a person assign themselves to a project, you will need the primary key value that refers to their record in your database as well as the primary key value of the project. Since you would execute this query from a form based on the project table you would include the primary key in a control on the form and reference that in the VALUES() portion of the append query. Similarly, when you have the person login, you can have their corresponding primary key held in a control on the login form. When the person logs in, hide the form, don't close it. As long as the login form is open you can reference any control on that form.

    With that, the append query would look something like this:

    Code:
    INSERT INTO T_ProjectEmployees ( fkProjID, fkEmpID )
    VALUES (forms![Projects Sign Up]!NameOfControlThatHoldsTheProjectsPrimaryKeyValue,forms!frm_Login!NameOfControlThatHoldsTheEmployeePrimaryKeyValue)

    In terms of preventing editing of data in the form, you can change the properties of the form (Allow Edits property) or controls (Locked property) on the form with code. For example, if you only want to give the person who created the project record the authority to change it, you would have to compare the ID of the person who created the record to that of the person who is logged in and then lock or unlock the controls as applicable. You would of course leave the button that executes the query unlocked at all times.

  3. #3
    taya621 is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jan 2011
    Posts
    38
    ....I am so lost..:P....example??

  4. #4
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I've attached the same example database from your last thread now modified with a login form, a main menu form and the project form with subform showing employees assigned to the project. You can look at the code behind the command button on the login form to see how I pull the user's ID value using a recordset and assigning it to the userID control on the login form. You will also need to review the code in the on current event of the project form/subform where I lock or unlock the controls based on whether the user is also the person who created the project record. Finally, in the code behind the assignment button, you will see how I construct and execute the append query.

    The user login name is firstname.lastname and the password is the word password.

  5. #5
    taya621 is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jan 2011
    Posts
    38
    J,
    What format does one sign in with for username? is it HarryPotter? h.potter? potter.h? I'm trying to run through as a user might and i'm not able to get it...
    thanks so much!

  6. #6
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    The format is: firstname.lastname (harry.potter)

    Case does not matter.

    In my example, Harry Potter was the creator for all records, so you will want to login as another user as well to see how the form acts based when the user<>creator

  7. #7
    taya621 is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jan 2011
    Posts
    38
    Wow, it works so perfectly! I've been trying to copy code and see what you've done but I've already messed up a few existing codes and relationships I had. Since I've done this database in pieces by using a lot of help, I don't know exactly what is connected and where so I'm afraid to move any more things and completely make my database unusable. I've attached my database as is at its latest version. can you walk me through what needs to be created so that the codes will work? i might have made my tables inefficient because i have some fields you don't and you have some fields I don't but i definitely succumb to your expertise so just tell me what to make. I know you told me I should make a separate table for the qualification questions (how important = slightly important, not important, etc.).. however, not all my questions have the same lookup answers. But if there is still yet a better of way of doing it, let me know. The login screen will not let you do anything unless you login and my username is dbadm and pass is dbadm.
    Thanks again so much, you have no idea where this databse could put me! )

  8. #8
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I'll have to take a look at your DB tonight since I only have Access 2003 here at work.

  9. #9
    taya621 is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jan 2011
    Posts
    38
    Great! I will be presenting this to my superiors tomorrow at 11a but i will check this forum early as soon as I come in. Again, thank you so very much! Are you a web developer or is this a hobby for you? I'm going to take MS Access classes soon - is that how you learned?

  10. #10
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I was actually working in a testing laboratory that used an Access database to track samples. I started messing with it and added other fuctionalities (simple searches etc.) to make things easier for me. The other users liked it so much, that they wanted me to do even more. ...and the rest is history...

    Basically, I am self-taught with the assistance of several Access forums and a few books on Visual Basic for Application (VBA).

    My work with Access started out as a way to help myself be more efficient at work, but I enjoyed it so much that it turned out to be a hobby as well and it help others out as well!

    As a matter of fact, I was just asked a few minutes ago by another department here at work to create an application to help them track part approvals from outside suppliers. The large number of parts and increasing requirements have made their Excel spreadsheets difficult to work with, so they now want to go to an Access application. Somehow they found out that I am somewhat proficient with Access, so now I have a new project... Since the Access stuff is not part of my job responsibilities, I do it in my spare time at work and at home.

  11. #11
    taya621 is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jan 2011
    Posts
    38
    Wow that's great! I'm glad for you that your being appreciated. I thought I could teach myself as well, I started using Access in the same way that you did but it really gets scary when it gets more complicated - at least without help. I work so hard sometimes on one aspect of the database but then when it comes to puttingin another thign that could ruin the first thing, I don't want to touch it! maybe i'll look for a VBA book - any recommendations?

  12. #12
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    My first VBA book was Access VBA Programming for Dummies by Alan Simpson. I still refer to it from time to time! I don't remember for which version of Access it was written, but I would guess that there are comparable books for Access 2007 and possibly Access 2010 available.

  13. #13
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I took an initial look at your database and found some issues. I see that you are using list/combo boxes at the table level. Although Access has this capability, it is generally not a good idea. You may want to check out this site for some details as to why it is not a good idea. I would generally put the items you currently have in the combo/list boxes as records in tables. That way you can easily add new items or change existing ones using some simple forms rather than having to get back into the table design.

    I just purchased Access 2010 and I see they have now added the ability to have calculated fields in a table. Again, although this is possible, the general rule is that calculated values are not stored, but rather calculated on the fly when you need them in forms, queries and reports. There are some rare times where storing a calculated value would be appropriate. From what I have seen, what you are doing would probably not qualify.

    I doubt that it would be possible to make the necessary corrections before your 11am meeting, so I would probably present what you have and qualify it as a first draft.

  14. #14
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I had a little time to play with your database tonight so I amended the login to use the actual user name rather than the role you had. I also added the "assign myself to a project" functionality that I had in my example database. Basically, the code just had to be modified for your table, field and form names. You will want to save the attached DB in another folder so as not to overwrite your current one.

  15. #15
    taya621 is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Jan 2011
    Posts
    38
    Wow, you are such a life saver! Is there a way to hide the navigation panel objects from all users except myself?

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

Similar Threads

  1. Replies: 1
    Last Post: 11-23-2010, 09:16 PM
  2. Pound sign in text field
    By eww in forum Programming
    Replies: 3
    Last Post: 09-29-2010, 10:30 AM
  3. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 AM
  4. Daily Sign In form
    By JHansford in forum Access
    Replies: 2
    Last Post: 12-09-2009, 08:41 AM
  5. The ampersand sign (&) and Access reports
    By tigers in forum Reports
    Replies: 2
    Last Post: 09-28-2009, 08:23 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