Assign Unique Tracking Number For Re-use

  • Re: Assign Unique Tracking Number For Re-use


    Quote from Dave Hawley

    I was thinking along the lines of the file being opened and added to behind the scenes via VBA so the user would not know.


    Thanks Dave I was trying not to open the excel file for the reasons I described earlier.


    Thanks to everyone that has helped me with this, I think I may have solved the problem if anyone can see potential problems please let me know - I would be very grateful.


    This code uses an ADO connection to create and edit a database of tracking numbers in a seperate excel file without opening it:



    And here is the same code modified to link with access (which is better because it requires less memory to store the data)


  • Re: Assign Unique Tracking Number For Re-use


    hi reafidy,


    Just looked at your ADO code. This is exactly what I had suggested. I have coded and tested similar ADO code today. The sample Access data base I have has two tables the first table is the register for new tracking numbers. It uses the Auto "number feature" to assign new tracking numbers. The second table is for tracking the activity as parts are installed, removed, scrapped etc.


    Since you are well on the way I’ll stop my development. Good luck.

    [FONT="Arial Black"][COLOR="blue"][SIZE="4"]Bill[/SIZE][/COLOR][/FONT]
    Tip: To avoid chasing code always use Option Explicit.

  • Re: Assign Unique Tracking Number For Re-use


    Hi Bill,


    Yeah I figured this was exactly what you are talking about. I always new that it was possible to bring a external database into excel I just was convinced it would be possible/easy to update the external databse while it was closed. Once you said it could be done I was convinced to investigate further and hence the result today. I have noticed that it still takes time to open the ADO connection over the wirless network but using an ADO connection to Access is 90% faster than opening the excel file and changing it and closing it (well in this situation it is anyway).


    THanks a lot Bill, Thanks to everyone.

  • Re: Assign Unique Tracking Number For Re-use


    Keyword (ignore) = sql


    Hello Reafidy,


    I think I heard once of a pooled connection that you could leave open for all users. I'll look into that. Although I don't know if your IT dept would appreciate that.[hr]*[/hr] Auto Merged Post;[dl]*[/dl]Pooled Connections is the way to go. Faster response time as a connection does not have to be built each time the db is accessed and less overhead on the network. Makes for IT happy campers.


    Here are some web sites to look through.


    http://www.sql-server-performa…r/asp_ado_pooling_p3.aspx


    http://support.microsoft.com/kb/q191572/


    http://support.microsoft.com/kb/169470/EN-US/ (frequently asked questions on ADO)


    http://msdn2.microsoft.com/en-us/library/ms524771.aspx


    http://databases.aspfaq.com/da…ion-string-look-like.html

    [FONT="Arial Black"][COLOR="blue"][SIZE="4"]Bill[/SIZE][/COLOR][/FONT]
    Tip: To avoid chasing code always use Option Explicit.

  • Re: Assign Unique Tracking Number For Re-use


    Well that was pretty successful at giving me a big headache. All this stuff is slightly out of knowledgebase.


    THe way I understand it a connection is created at global scope perhaps when the workbook is opened. Then a new connection does not have to be made each time we want to access the database which decreases the load on the network. Then we close the connection when the workbook shutsdown?


    But I assume a connection still has to be made by each user right?


    Do I have the right idea?


    Thanks Bill.

  • Re: Assign Unique Tracking Number For Re-use


    My understanding is that multiple users can use the same connection as long as the connection verbiage is exactly the same. The connection will time out (I think the default is 60 seconds), but that can be changed. I’m getting into an area I’ve never been before. Yes, it gave me a headache also.


    Perhaps a new thread is order on the Access forum?

    [FONT="Arial Black"][COLOR="blue"][SIZE="4"]Bill[/SIZE][/COLOR][/FONT]
    Tip: To avoid chasing code always use Option Explicit.

  • Re: Assign Unique Tracking Number For Re-use


    Hey, Reafidy,


    Before you go down the Access path, what's the advantage over using a text file with comma-delimited fields? Does the additional data needed for capture (the stuff other than the sequential number) warrant the use of a database?

    [SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

  • Re: Assign Unique Tracking Number For Re-use


    No the advantage is that i dont have to open the access file.


    And I dont see how you can avoid opening the txt file?


    Because I can read the number from the txt file but I dont know how to edit the text file to show that number has been taken.

  • Re: Assign Unique Tracking Number For Re-use


    Reafidy,


    Here's my entry to get sequential numbers from a text file.


    Text file with two examples.
    [ss=00001,2007-0910-21:09:00,shg,N01235,manifold
    00002,2007-0910-23:09:19,Sky King,N-67832,sump pump]*[/ss]

    [SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

  • Re: Assign Unique Tracking Number For Re-use


    SHG,


    Have tried and tested your code works! Theres some nice code there!!


    What I have been doing is loading the databases up to about 20000 parts.


    The problem is that when opening file the code takes a long time to execute. Your code takes about 10 seconds. But it is also making backups and things which may not be neccessary so Ill look into it some more.


    Thanks a lot for your help much appreciated.

  • Re: Assign Unique Tracking Number For Re-use


    Quote

    What I have been doing is loading the databases up to about 20000 parts.


    Is that an integrated part of this problem? It would seem that a parts DB (Access, Excel, whatever) could be copied to each laptop, and synchronized periodically as necessary.


    Quote

    Your code takes about 10 seconds


    Yep -- had no clue about that, and no easy way to meaningfully test. It takes less than a second on my laptop, but that's local, and with a short file.


    Reading the source file to the end just to get the last record is surely a waste of network time (read, get data, read, get data, ...). There should be a way to just seek to, and then read, just the last record.


    VBA supports several methods for file I/O, and each has its own methods for reading and writing. I'd like to see a tutorial that summarizes them all and explains the rationale for each.

    [SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

  • Re: Assign Unique Tracking Number For Re-use


    Quote from shg

    Is that an integrated part of this problem? It would seem that a parts DB (Access, Excel, whatever) could be copied to each laptop, and synchronized periodically as necessary.


    Yes thats another good idea. Im going to follow through with the ADO connection untill I get to the stage where I understand the pros and cons of connecting to ADO then assess which option to go with.


    Quote from shg

    I'd like to see a tutorial that summarizes them all and explains the rationale for each.


    Me too.


    Thanks for your help buddy.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!