Default Value of a field

G

Guest

I have 2 fields - policy number and policy type. I would like the user to
enter the policy number and then have the policy type automatically be set to
the first 3 characters of the policy number field. Is this possible?
Doesn't matter where it has to be done, but I would like it to either be done
in the table or the form.
Thanks!
 
G

Guest

On the after update event of the policy number you can write the code

Me.[policy type Field Name] = left(me.[policy number Field Name],3)
 
G

Guest

Thanks so much, it worked awesome. One more question. If I needed 3
characters when the policy number was 8 characters and only 2 characters if
the policy number was 7 characters. How would I write that?
Thanks!!

Ofer said:
On the after update event of the policy number you can write the code

Me.[policy type Field Name] = left(me.[policy number Field Name],3)

--
I hope that helped
Good luck


theitman said:
I have 2 fields - policy number and policy type. I would like the user to
enter the policy number and then have the policy type automatically be set to
the first 3 characters of the policy number field. Is this possible?
Doesn't matter where it has to be done, but I would like it to either be done
in the table or the form.
Thanks!
 
G

Guest

Try this
If Len(me.[policy number Field Name]) = 7 then
Me.[policy type Field Name] = left(me.[policy number Field Name],2)
Else
Me.[policy type Field Name] = left(me.[policy number Field Name],3)
End If

--
I hope that helped
Good luck


theitman said:
Thanks so much, it worked awesome. One more question. If I needed 3
characters when the policy number was 8 characters and only 2 characters if
the policy number was 7 characters. How would I write that?
Thanks!!

Ofer said:
On the after update event of the policy number you can write the code

Me.[policy type Field Name] = left(me.[policy number Field Name],3)

--
I hope that helped
Good luck


theitman said:
I have 2 fields - policy number and policy type. I would like the user to
enter the policy number and then have the policy type automatically be set to
the first 3 characters of the policy number field. Is this possible?
Doesn't matter where it has to be done, but I would like it to either be done
in the table or the form.
Thanks!
 
G

Guest

Thanks again!!

Ofer said:
Try this
If Len(me.[policy number Field Name]) = 7 then
Me.[policy type Field Name] = left(me.[policy number Field Name],2)
Else
Me.[policy type Field Name] = left(me.[policy number Field Name],3)
End If

--
I hope that helped
Good luck


theitman said:
Thanks so much, it worked awesome. One more question. If I needed 3
characters when the policy number was 8 characters and only 2 characters if
the policy number was 7 characters. How would I write that?
Thanks!!

Ofer said:
On the after update event of the policy number you can write the code

Me.[policy type Field Name] = left(me.[policy number Field Name],3)

--
I hope that helped
Good luck


:

I have 2 fields - policy number and policy type. I would like the user to
enter the policy number and then have the policy type automatically be set to
the first 3 characters of the policy number field. Is this possible?
Doesn't matter where it has to be done, but I would like it to either be done
in the table or the form.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top