Solved

Default Value in Cell

Posted on 2014-01-03
3
248 Views
Last Modified: 2014-01-04
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!
0
Comment
Question by:cansevin
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39755382
try using dlookup()


=dlookup("[Last]","qryWhosComputer")
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 39755451
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

0
 

Author Closing Comment

by:cansevin
ID: 39756425
Thanks! Worked.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now