Results 1 to 3 of 3
  1. #1
    Join Date
    May 2005

    Unanswered: Main Number-Primary Key Thing--


    My company is moving and now I have to set the program to work from multiple locations. I am trying to decide how to come up with the generated main number(primary key) for each shipment.

    Should I bind the form to the networked table or, should I have a mathematically created number that then inserts the number into the table?

    I was thinking of having the program check the table for the max() number, but if multiple people do it at the same time we may run into duplicate numbers and errors.

    Any ideas on how to make this work?

    FYI the math equation I did was nothing serious just:

    Dim punUser As Single
    Dim punMonth As Single
    Dim punDate As Single
    Dim punYear As Single
    Dim punHour As Single
    Dim punMin As Single
    Dim punSec As Single
    Dim punNum As Single
    punMonth = Month(Date)
    punDate = Day(Date)
    punYear = Year(Date)
    punHour = Hour(Now())
    punMin = Minute(Now())
    punSec = Second(Now())
    DoCmd.OpenForm "frmCurrentUser"
    punUser = Forms!frmCurrentUser!txtCurrent
    DoCmd.Close acForm, "frmCurrentUser"
    punNum = (punUser * punMonth) + (punUser * punDate) + (punUser * punYear) + (punUser * punHour) + (punUser * punMin) + (punUser * punSec)
    If Len(punMin) = 1 Then
    punMin = "0" & punMin
    End If
    Me.txttmpPUN = punNum & punMin & "-" & punMonth & punDate & punYear & "-" & punUser

  2. #2
    Join Date
    Sep 2003
    Is your company going to have a network connection of some kind between locations?

    If so, then what you have for your number gen should be ok ... Except for you'll want the db to be on the client connecting to a common server.

    If not, then you'll have more work to do. A way to do this is to assign ranges of numbers to each location that way there are no dups and then you can merge the datsets together without and hassles (or less painful hassles) ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    May 2005
    Thank you for the prompt response, I am finally able to get back into the programming with my job so I can come back to this site again YAAAY!

    Yes I believe we are looking into ip telephony... these are all new grounds for me.

    I was thinking I would (On Login...) connect to the tables and update all local tables with the most recent info from the networked tables. This way when looking up information it would be faster, also limiting who can gain access to which tables.

    When trying to do searches, I would query based on the criteria entered and then populate the form.

    I am doing this all on the blind, my first version of this program has lasted 2 years and was based out of one location so I am hoping my unorthodox style will come through for me again.

Posting Permissions

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