Results 1 to 2 of 2
  1. #1
    frcastro is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    13

    update querie


    Hi

    I am building a protocol database.

    I have a table where I have a automatic generated ID number. And I have the 4 types of protocol (A, B, C, D).

    I have 4 fields that are "Number for A", "Number for B", "Number for C", "Number for D".

    I want to make the first field in ID that has protocol A to be number 1 in "Number for A" and so on. The same thing for B, C and D.

    Thanks!!

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    If I'm understanding you correctly, you want it to increment for each individual leter. For example, if you had the below rows.

    A
    A
    B
    B
    C
    C
    C

    You would want it to return as follows
    1
    2
    1
    2
    1
    2
    3

    If that's the case, you could try something like this.

    dim intCountA as Integer
    dim intMaxA as Integer

    intCountA=DCount("*","MyTable","MyField='A'")

    if intCountA > 0 then
    intMaxA=DMax("[MyID]","MyTable","MyField='A'")
    Me.MyID=intMaxA + 1
    Else
    Me.MyID=1
    End if

    You would do this for each one of the letters.

    Quote Originally Posted by frcastro View Post
    Hi

    I am building a protocol database.

    I have a table where I have a automatic generated ID number. And I have the 4 types of protocol (A, B, C, D).

    I have 4 fields that are "Number for A", "Number for B", "Number for C", "Number for D".

    I want to make the first field in ID that has protocol A to be number 1 in "Number for A" and so on. The same thing for B, C and D.

    Thanks!!

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

Similar Threads

  1. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 AM
  2. querie problem
    By TIMT in forum Queries
    Replies: 2
    Last Post: 05-31-2009, 10:12 AM

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