Avatar of cansevin
cansevin
 asked on

Default Value in Cell

I have a query that only has 1 row to it. I would like the default value of a field to the third column of that row.

I tried to simply reference that cell in expression field like this:

=[qryWhosComputer]![Last]

Unfortunately it comes up an error. Is there a way I can refence the default value to be that "Last" column of that query? Maybe telling it the first row somehow? All the query does is match to values from two tables. There always is a one-to-one relationship.

Thanks for any help you can provide!
Microsoft Access

Avatar of undefined
Last Comment
cansevin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rey Obrero (Capricorn1)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
PatHartman

1.  Defaults can be set for columns in tables, controls on forms, or in code behind a form.  Queries do not support defaults, events, or code.
2. Users should NEVER be exposed to a query.  You should always use a form for data entry or a report for displaying data.

To do what you are asking in a form, you can use the Form's BeforeUpdate event.  You can either just fill in the empty value or you can prompt.

If Me.SomeField & "" = "" Then
    Me.SomeField = Me.ThirdColumn
End If

Open in new window

cansevin

ASKER
Thanks! Worked.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy