[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Default Value in Cell

Posted on 2014-01-03
3
Medium Priority
?
259 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 120

Accepted Solution

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


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

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

873 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