Solved

Default Value in Cell

Posted on 2014-01-03
3
250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

896 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

17 Experts available now in Live!

Get 1:1 Help Now