Default Value - Recent Entry

C

Cole Davidson

Hello. I am working with a database comparing the insured value for a certain
building and the actual value of the building. I have one table
(PolicyHolderInfo) in which I have two fields, PolicyNumber and PolicyHolder.
I have another table (BuildingInfo) in which I have PolicyNumber,
BuildingName, BuildingType, InsuredValue, and EstimatedValue. Currently I
have the two PolicyNumber fields tied together so once I input it into the
PolicyHolderInfo table, it will appear in a drop down menu in BuildingInfo.
However, I have thousands of buildings to input, and hundreds of policy
holders to input so looking through the list for the correct number takes
quite a bit of time. Is there anyway that I can set the Default Value of
PolicyNumber in BuildingInfo Table to the most recently entered PolicyNumber
in PolicyHolderInfo? And if not, what about the most recently entered
PolicyNumber in the previous BuildingInfo record?
 
J

Jeanette Cunningham

Hi Cole,
to set a default value is easy in code.
Put a button on the form and call it something like cmdDefault.
Put code like this-->
Private Sub cmdDefault_Click()
Me.PolicyNumber.DefaultValue = Me.PolicyNumber
End Sub

For text data, use the following instead-->
Me.PolicyNumber.DefaultValue = """" & Me.PolicyNumber & '"""

That's 4 double quotes either end of the policy number.

Change PolicyNumber to the name of the control on the form for policy
number.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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