Re: Creating Unique IDs (SORRY-Double post)
From your explaination I would assume that the Control Source property has a formula in it. Is this true? If it is ... It will need to be MemberID. This will bind it to the memberid field, hence sending the information to that field ...
Now to get the actual information into it .... Create the following code
If LastName <> "" AND FirstName <> "" and PhoneNumber <> "" Then
MemberID = Left(LastName, 2) & Left(FirstName, 2) & Left(PhoneNumber, 5)
Now create code for the AfterUpdate event if the 3 fields .... and the code needs to read
To do this... Select LastName. Bring up the properties dialog box, select the event tab, select AfterUpdate and click on ...
Select Code from the dialog box and the following should display ....
Private Sub LastName_AfterUpadte()
Add GeneratePK between the two line ans repeat the process for FisrtName and PhoneNumber fields ...
Hope this works ...
Originally posted by Taipei
I apologize for not knowing much of the proper terminology. I am a long time computer user... but have never done any programing. I am working on my first database which is more than an address book.
I am really having a hard time understanding table relationships. I also can't seem to get a grasp on queries. I know that both are CRITICAL.
My specific question is as follows:
Let's say I want the following fields in a table called MEMBERS.
I can create a form to collect that info. But what I would really like is for the field Member ID to be created using data from the LastName, FirstName, and PhoneNumber fields.
I can set up my form to even display the unique id that I want, but the id is not entered into the table. That is my problem.
I want the id to be in this format:
LL=1st 2 letters of LastName
FF=1st 2 letters of FirstName
NNNNN=Last 5 digits of Phone Number
Like I mentioned, I can use the "Left" and "right" functions to display that info in a form... BUT that ID is not entered into my table.
I know this is a simple question for most of you.
Thanks for any help you can provide.
Life is too short to be sane or sensible. Weird people rule and normal people suck