Results 1 to 8 of 8

Thread: Autonumber Problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    107

    Autonumber Problem

    OK guys, I have a table in access like this

    ClientID - Autonumber
    ClientName - Text

    Also I have a table like this

    SportID - Autonumber
    SportName - Text

    And lastly, a table like this

    ClientID - Number
    SportID - Number

    OK, I shouldnt have to explain that any more because its just a simple 2 tables design with a linking table.... anyways my problem is that I have a separate table in a different database like this

    ClientID - Number
    SportID - Number
    ClientName - Text
    SportName - Text

    Now the data in this database I need to move over into the first database, the problem I have is that when I try to copy and paste append I cannot paste the ClientID because it upsets the autonumber - I can paste the data if I change the datatype from autonumber to number, but then it wont allow me to change the datatype back to autonumber after I have populated the tables.

    In the second database the ClientID and the SportID are the same value and are basically the first record's value is 5000 and the last value is 6875.

    I do appologies if the description is a little sketchy but I have had several pints and several whiskey's and everything is starting to look a little blurry.

    Would be greatful if anyone has any ideas.

    Oh yeah BTW - this isnt the actual table design, but if you answer the question then I will be able to implement it into my rather larger proper design. Cheers in advanced.
    Last edited by DaGeeza; Feb 18th, 2006 at 04:43 PM.
    I am not suffering from insanity......... ...........I am loving every minute of it.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Autonumber Problem

    Which table are you trying to paste the data into that causes the ClientID to error?
    You can only have one autonumber field in a single table.Do you have any restrictions on the ClientID field like Indexed (No duplicates) etc.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    107

    Re: Autonumber Problem

    Sorry wasnt too clear - If you open up access and create a table like this

    ClientID - AutoNumber
    ClientName - Text

    and another like this

    TestID - Number
    TestName - Text

    now enter data so Test table looks like this

    TestID|TestName
    5000|Fred
    5004|Jim
    5020|Paul
    5026|James

    I want to put that into the first table but when I copy and past I get this

    ClientID|ClientName
    1|Fred
    2|Jim
    3|Paul
    4|James

    I need the autonumber to remain the original 5000 odd number so that the linking table links to the correct data.
    I am not suffering from insanity......... ...........I am loving every minute of it.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Autonumber Problem

    Then the ClientID should be a Numberic type because you want to numbering to follow the TestID values instead of creating new number values.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    107

    Re: Autonumber Problem

    So what do I do about creating a new Client? how should I give it a new ClientID?
    I am not suffering from insanity......... ...........I am loving every minute of it.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Autonumber Problem

    Looking at your schema I think we would need to rethink it a bit.

    Since the Client is the initial object that is where the id should be autonumbering from.

    I dont think you can have a Test without a Client so the test would have its own ID.

    How can a Client and Test be the same name?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: Autonumber Problem

    create a query

    SELECT Table1.*, Table1.mike+5000 as client_id
    FROM Table1;
    from the query you can relate the client_id to the test_id

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Autonumber Problem

    Probably have a design like so.
    Code:
    Clients 
    ---------------
    ClientID *
    ClientName 
    
    Tests
    ---------------
    TestID *
    ClientID
    TestName
    Then you can have each field with the asterisk as an Autonumber field type. The ClientID fiels will be your fields to JOIN on.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width