W
Wayne-I-M
Hi
I have 2 tables
Groups and Clients
Groups = GroupID, etc, etc
Clients = ClientID, GroupID, BookRef, etc,etc
GroupID and ClientID are auto numbers and BookRef is text.
I have a form that sets the value of the BookRef like this
Private Sub Form_BeforeInsert(Cancel As Integer)
If Me.NewRecord Then
Me.ClientID = Nz(DMax("[ClientID]", "tblClients", "[GroupID] = " &
Me.GroupID)) + 1
Me.BookRef = Me.GroupID & "-" & Me.ClientID & "-" &
Right(Str(Year([Forms]![frmGroups]![TripStart])), 2)
End If
End Sub
Trip start is a date field on the main form - frmGroups
This works fine and you get a BookRef like this (incremented 1 for each new
client in any given group)
GroupID - ClientID - Year(last 2 digits)
BUT
I hav had some comments from users that this "looks" like a "date" eg.
if you have a group 10 and then book 9 people into this on a event that is
taking pace during 2009 you will get
10-9-09
Now this does not matter to the admin staff but it can confused clients. So
I was thinking how to increment the ClientID within the BookRef so it would
look like this
10-I-09
10-J-09
10-K-09
etc.
I have looked at
Me.BookRef = Me.GroupID & "-" & Chr(Asc(Nz(DMax("[ClientID]", "tblClients",
"[GroupID] =
" & Me.GroupID),"@")) + 1) & "-" &
Right(Str(Year([Forms]![frmGroups]![TripStart])), 2)
So added this
Chr(Asc(Nz(DMax("[ClientID]", "tblClients", "[GroupID] =
" & Me.GroupID),"@")) + 1)
But it's still not getting there - been trying for quite a while,
Any ideas would be really helpfull
Many thanks
I have 2 tables
Groups and Clients
Groups = GroupID, etc, etc
Clients = ClientID, GroupID, BookRef, etc,etc
GroupID and ClientID are auto numbers and BookRef is text.
I have a form that sets the value of the BookRef like this
Private Sub Form_BeforeInsert(Cancel As Integer)
If Me.NewRecord Then
Me.ClientID = Nz(DMax("[ClientID]", "tblClients", "[GroupID] = " &
Me.GroupID)) + 1
Me.BookRef = Me.GroupID & "-" & Me.ClientID & "-" &
Right(Str(Year([Forms]![frmGroups]![TripStart])), 2)
End If
End Sub
Trip start is a date field on the main form - frmGroups
This works fine and you get a BookRef like this (incremented 1 for each new
client in any given group)
GroupID - ClientID - Year(last 2 digits)
BUT
I hav had some comments from users that this "looks" like a "date" eg.
if you have a group 10 and then book 9 people into this on a event that is
taking pace during 2009 you will get
10-9-09
Now this does not matter to the admin staff but it can confused clients. So
I was thinking how to increment the ClientID within the BookRef so it would
look like this
10-I-09
10-J-09
10-K-09
etc.
I have looked at
Me.BookRef = Me.GroupID & "-" & Chr(Asc(Nz(DMax("[ClientID]", "tblClients",
"[GroupID] =
" & Me.GroupID),"@")) + 1) & "-" &
Right(Str(Year([Forms]![frmGroups]![TripStart])), 2)
So added this
Chr(Asc(Nz(DMax("[ClientID]", "tblClients", "[GroupID] =
" & Me.GroupID),"@")) + 1)
But it's still not getting there - been trying for quite a while,
Any ideas would be really helpfull
Many thanks