Results 1 to 13 of 13
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Limit user to one selection

    Purpose: Make sure user can ONLY use the employee for that timecard(s) hours.


    Explanation; I need to make sure the user can ONLY use the employee from the main form when entering records for the subform.
    If employee is Billy Bob, then ONLY his name will go in the field EmployeesTime even though it is a combo. This combo has other code that fires as well.
    NameB.Column(1) on the main form contains the name of the employee being used for the timecard.

    Main Form TimeCards
    Subform Time_Hours
    Combo on subform named EmployeesTime w/list of employees.

    TimeCard is ONLY for that one person.
    Attached Thumbnails Attached Thumbnails TimeCard.jpg  

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    speaking very generally: a query can have criteria. and that criteria can be BillyBob - so only that record is its result.

    more specifically then is where you implement this; a combobox is a query - and so it can be implemented there resulting in the combobox only displaying BillyBob. - or - the form can have its record source as a query - so it can be implemented at this level.

    completing the circle then is how does the criteria get defined? ... there must be a log in so that 'BillyBob' is a value in a text box of an open form - that the query can call.

    hope this makes sense.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    NO, it is important that the list remains intact and yes the combo is a query but I still need to either make it use the default employee on the main form or some other means to keep a user error from occurring. I can't set the control source to anything else as this is code reliant. When they move from record to record they need to keep whatever employee is on the main form as the employee they will use for the subform. i.e. all records on the subform will be for just ONE employee. Clear as Mud?

  4. #4
    ssanfu is online now Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,289
    If the relationship is Main form/sub-form, you shouldn't have to do anything to keep them synchronized. In design view of the main form, click on the subform control, then open properties. You should see the linking fields in the dialog box - "Link Child Fields" and "Link Master Fields". As long as these two properties are set correctly, they will be in synch, ie the subform will show only those records linked to the main form.
    No code necessary.
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    The relationship between the sub and main is correct! The user can choose from the combo and add someone Else's time to that timecard is THE problem. Back to what I was getting at, which is to force them to use the correct employee for that timecard. Main form, navigate to next record, you can use a new employee to add time to! This is ok, and you can add as many daily timecards as you wish for each employee, but NOT be able to add another employees time to your timecard! Billy Bob can have many timecards on many different days,etc... but NOT put someone Else's time on his card! Thats like punching in for someone else, it is NOT allowed. Will Payroll be correct, I think not!

  6. #6
    ssanfu is online now Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,289
    Are you saying that John Boy can select Billy Bob and enter work hours, but John Boy should be able to only see and enter hours for himself?
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Yep, exactly! Houston, we have a problem. They can choose whoever they want right now and enter away! Hey, it's a combo, make a selection!!!
    You are on the main form with a subform below. From the subform you can choose whoever you want to enter time for. It should be limited to ONLY whoever is on the main form or as in this case who is shows even on the subform. As the pic showed, the timecard is ONLY for ONE person ONLY. You may advance to the next record using the Main form and enter for another employee. One Main Form Record Per Employee!!!
    Last edited by burrina; 01-12-2013 at 12:41 AM. Reason: clarify

  8. #8
    ssanfu is online now Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,289
    If you HAVE to have a combo box, then anyone can look at/change anyone Else's time.
    The enter/view Hours would/should have to have a user (EID) control and a password control plus a button to check the UID/PW then bring up the employee info. Does that make sense??
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  9. #9
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I have not gotten around to making them login to the form if that is what you are saying. It would not of course solve the problem. I can log who entered the data, sure but if they make a mistake, then holy krap batman! Maybe this just can't be fixed, just alerted is all! I do have a way to move time back to the correct TimeCard, but this is not Plan A ?

    Maybe you can help me with this. I need to set focus back to the main form from the subform and use this code to try and make the subform keep the same value as the previous record. TimeCards is the main form and Time and Hours is the name of the subform. I have forgot, something about Me.Parent ???

    Me.EmployeesTime.DefaultValue = """" & [Forms]![TimeCards].Form![NameA] & """"
    Last edited by burrina; 01-12-2013 at 02:46 AM. Reason: code

  10. #10
    ssanfu is online now Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,289
    The only way you should be able to get to the place to enter the hours is to be validated as to who you are by entering a userID (EID) and a password. To enter hours, a UID/PW MUST be entered. Otherwise you wouldn't be able to get paid. That is the way it should work.

    If you use a combo box without any login verification, there is no way that I know of to keep John Boy from seeing/entering hours for Billy Bob. Anyone could do anything to someone else's hours.

    Login Verification is a MUST!

    If you enter someone else's userID and password or even know the UID/PW, then that is an administrative problem, not an automation problem. If you give your UID/PW to anyone, then you get time off without pay ... or terminated. Same penalties if you enter/change someone else's hours.
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  11. #11
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    That is an easy fix but I don't see how it will stop someone from screwing up? You will just know who did it is all.

  12. #12
    ssanfu is online now Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,289
    I don't see how it will stop someone from screwing up?
    What do you mean? Entering 8 hours when they only work 2 hours? Who approves the hours worked? Again, this is an administrative problem.


    If there was validation in effect, how would you enter your hours in my timesheet if you logged in with your UID/PW? Lets say there is a combo box to select the employee name. You select "Burrina". You would still have to enter a PW. If you entered the correct PW, the only info would be yours. If you use the combo box to select me, "ssanfu", you would have to enter MY PW. Without MY PW, you wouldn't be able to see/enter hours for me.

    Its like going to an ATM. The only info/money you can get is yours. To get someone else's money you need their UID (credit card) AND their PW (PIN). You both have accounts at the same bank, but you cannot get to anyone else's account/info.
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

  13. #13
    ssanfu is online now Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,289
    Or are you talking about a clerk entering hours from a paper time sheet or a time clock card? No way to stop someone getting the wrong hours. Again - administrative problem.....
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 06-23-2014, 12:19 PM
  2. Replies: 1
    Last Post: 12-09-2012, 05:27 PM
  3. Replies: 1
    Last Post: 02-01-2012, 11:27 PM
  4. Limit User access in Runtime
    By ggs in forum Access
    Replies: 2
    Last Post: 07-03-2011, 04:31 AM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 AM

Tags for this Thread

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 - Senior Forums