Results 1 to 4 of 4
  1. #1
    eskybel is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    74

    Copying newly entered record back into form?

    Hello all,

    This might be a real simple fix, and I'm just missing it, but here's what I'm looking to do:

    I have a form, where all necessary data is filled out for a specific project. This form is tied to a table that holds all the information, with a couple controls on the form pointing to a couple different tables, such as tblEmployeeList and tblCustomerList. At the end, the user can either go to the next record, enter data on the form again, or close the form. The part I'm stuck on is in regards to the employee field on the form, which lists the employee involved in the "project" for which the form is filled out.

    Right now, the form gets filled out for this specific project, and only one employee can be entered at a time. The problem is a single project can be worked on by up to 10 employees. Right now, they fill the form, enter one employee's name, and the form clears, and they have to retype it. This works, but it is inefficient.



    I also have another version of the main table and form has 10 combo boxes where they could select the different employee's names in each, and these would go into their own fields in the single record for the project. The problem with this came when trying to run a query to ask "which projects has [this] employee worked on?" and it would be done with a "like [Employee name?]" in the criteria for each field, and asks for the name 10 times. Obviously this is also a problem.

    It seems it might be easiest to go with the database that has the one employee entry per form, then have a way to duplicate the info on the form, change the employee name, and have it create another record, exactly the same, except the employee name, but this creates a lot of records. If there is a good way to query 10 fields (emp1-10) in each record, and have it only ask for the employee's name once, then spit out the report based on your entry for the query, but I can't seem to get that working either (always getting a blank report).

    Again, I'm probably missing something easy.

    If I haven't explained it well, or am missing some key information, please let me know.

    Thank you

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I got kind of dizzy, trying to follow the ins and outs of your explanation, but if you want to enter Multiple Records, one following the other, where the only difference in each Record is the Employee's name, you can use the AfterUpdate event of the Control holding your data to set the DefaultValue for the Field. From that time forward, until you either manually change the data or close your form, the data will be entered automatically in each New Record.

    Code:
    Private Sub YourControlName_AfterUpdate()
       Me.YourControlName.DefaultValue = """" & Me.YourControlName.Value & """"
    End Sub
    You’ll need to do this for each Control that you want to ‘carry forward.’

    Note that this code/syntax can be used for any Datatype.

    Another approach for this kind of thing would be to have a separate ProjectEmployees Table, related to the Projects Table by a ProjectID Field, that’s present in the Projects Table as the Primary Key and in the ProjectEmployees Table as a Foreign Key. You’d then create a Form for each Table, with all the project info in the Projects Table/Form, and have the ProjectEmployees Form displayed as a Subform on the Main, i.e. Projects Form.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    eskybel is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    74
    Quote Originally Posted by Missinglinq View Post
    Another approach for this kind of thing would be to have a separate ProjectEmployees Table, related to the Projects Table by a ProjectID Field, that’s present in the Projects Table as the Primary Key and in the ProjectEmployees Table as a Foreign Key. You’d then create a Form for each Table, with all the project info in the Projects Table/Form, and have the ProjectEmployees Form displayed as a Subform on the Main, i.e. Projects Form.

    Linq ;0)>
    Sorry for the spaghetti plate of a description.
    This sounds like a good idea. I'll run with this for a bit and see if I can get it working properly, and report back when (I'm sure) I have another question.

    Thanks for the help!

  4. #4
    eskybel is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    74
    I found an action for a command button that duplicates the record. They have the form, they fill it out, they enter the first employee name, then they hit the button "add employee to project" and it duplicates the record, and they change the name in the drop down, then they close when they're done. It works well enough for me.
    Thanks!

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

Similar Threads

  1. copying a record and adding in new text
    By will_clarke in forum Access
    Replies: 1
    Last Post: 01-12-2012, 11:08 AM
  2. Copying Values from One Record to Another
    By Iconoclast in forum Access
    Replies: 5
    Last Post: 08-02-2011, 11:59 AM
  3. Replies: 2
    Last Post: 03-25-2011, 12:22 PM
  4. Replies: 7
    Last Post: 04-27-2010, 10:29 AM
  5. Replies: 0
    Last Post: 11-10-2008, 12:32 PM

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