Thank you both - it works!!!
"PieterLinden via AccessMonster.com" wrote:
> Lori LeRoy wrote:
> >I would like to assign a value to a field when closing a form. I have three
> >employees (buyers) that we manually assign records for them to work. I would
> >like to do this automatically based on the ID# of the record. I have the
> >idea of what to do, but not sure how to program it.
> >
> >In my table - tblreqs - I would like to automatically assign a buyer (# 10
> >or #26 or #29) based on the ReqHeaderID.
> >On close, if ReqHeader ID ends in 1,4,7, or 0, Buyer = 26; If ReqHeaderID
> >ends in 2,5,8 Buyer = 29; If ReqHeaderID ends in 3, 6, 9 Buyer - 10.
> >
> >Can someone tell me how to write this code? Thanks!
>
> dim strRightChar as string
> strRightChar = RIGHT$(ReqHeaderID, 1)
> Select Case strRightChar
> Case 0,1,4,7
> Me.Buyer = 26
> Case 2,5,8
> Me.Buyer = 29
> Case 3,6,9
> Me.Buyer = 10
> End Select
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...oding/201005/1
>
> .
>