Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    copy a record to a new table (2000)

    How do I copy a record that I have selected from a combo box to a new table?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: copy a record to a new table (2000)

    What do you mean, a record you have selected from a combobox?
    Charlotte

  3. #3
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: copy a record to a new table (2000)

    I have created a combo box with fields that are bound to it. When I select the item I want out of the combo box I want the selected item and the related fields to be added to a new table?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: copy a record to a new table (2000)

    There are two issues here. One is *why* you are copying data from one table to another. That isn't normally done unless you're using a temporary table for something like reporting. Second is that the combobox simply lists the data in its rowsource. You could create code to open a recordset on the new table and loop through the columns of the combobox adding the individual items to the recordset, but a simply append query using the keys from the selection in the combobox would be easier.
    Charlotte

  5. #5
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: copy a record to a new table (2000)

    I am choosing info from the combo box to be put into a new table because I want to leave the original table intact and only include in the new table the info I choose from the combo box. I do not know how to write code to get the above accomplished. Could you give me an example. Also, I have tried to do an append query several times but it will not select only the data I have selected from the combo box. It has copied either the whole table or nothing at all.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: copy a record to a new table (2000)

    If you use the append query, you'll need to reference the combobox in the critiera of the append query. Whatever the key field is in the table/combobox, that's the field that needs the combobox as the critieria.
    Charlotte

  7. #7
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: copy a record to a new table (2000)

    Thank you. I'm not sure how I would write the criteria. My key field in my combo box is "parts". So would my criteria read = parts?

  8. #8
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: copy a record to a new table (2000)

    No, the criteria would need to be the value of the key field in your combo box. But I think the real issue here is that we need more info in order to be able to help you. First we need to know a bit about your table structure, and what the permanent and the temporary tables look like. Second we need to know if the form that contains your combo box is bound to the permanent table, and if so what other fields are displayed on that form. Finally we need to know what the Row Source for the Combo box is.

    To do what you are asking, and copy a single record to a temporary table is easily done with a simple display form that lets you navigate through the records in the table, and has a button that you click which runs an append query that record only, using a criteria something like
    <font color=blue>Parts=Forms!MyForm!RecordID</font color=blue>
    where the RecordID is the primary key for the permanent table.
    You could use the standard navigation tools for forms, or you could use an unbound combo box to select the records based on some descriptive field (the combo box wizard will build one of these for you).

    One issue you will want to consider is what should happen if the record has already been copied to the temporary table, and the user tries to do it a second time. Hope this helps some.
    Wendell

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: copy a record to a new table (2000)

    In the criteria line of the query, under the field you want to filter, put a reference to your combobox like this: <font color=blue>Forms!MyForm!Parts</font color=blue>

    This assumes that the bound column of the combobox holds a value found in the field you're filtering.
    Charlotte

  10. #10
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: copy a record to a new table (2000)

    I entered the code forms!myform!parts in the criteria of my append query. However when it does this it asks for a parameter value? I'm not sure what it is asking for. What I am trying to do is : I have a parts list with over a 1,000 different parts. In my original table i have a field for the part #, the description of the part, and the manufacturer that part. I need to be able to select a part# and have that part# with the other fields added to a temporary table. I then want to export this new temporary table to excel where I have a form created that will be sent the manufacturer of those parts so they can be ordered.

    *side note: both the original table and temporary table are set up exactly the same. My row source : selects a query (which i did off my original table (got rid of junk out of the table)

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

    Re: copy a record to a new table (2000)

    Why don't you post the database (without sensitive data) and tell us which form you are doing this with and what is the source table (with the part#) and which is the temporary table that you want the information (and what information this is) to be inserted into.
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: copy a record to a new table (2000)

    Is your form actually named "MyForm"? I used that as a placeholder and you have to put the real form name in the criteria.
    Charlotte

  13. #13
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: copy a record to a new table (2000)

    <P ID="nt"><font size=-1>(No Text)</font>

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

    Re: copy a record to a new table (2000)

    My email says that you sent a database, but I don't see it !! <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  15. #15
    Lounger
    Join Date
    Aug 2001
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: copy a record to a new table (2000)

    I tried but I'm not sure how to post it. I clicked on browse on the site and located my database and attached it? Was that correct? If so, I do not see where it prompts you to look at it? Please advise. Thanks

Page 1 of 2 12 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
  •