473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using a query for a standard value

65
Hi,

I'd like to use a standard value in a field. This value should be the lowest value of a table minus 1. The query I wrote for this works and looks like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT Min(dkey) AS dkeylock
  2. FROM VetAbsorptie;
  3.  
Now when I ask for dkeylock with the build function (I select it from the query), access gives me a #NAME? error. Anybody who knows how to solve this??

Greetz

Twanne

I made a whole in my brain to fit a mountain
Sep 6 '07 #1
4 1353
Twanne
65
I could realy use some help here, the query returns exactly one record so it should work, no? Or is it because I select the field from the query itself?

Greetz

Twanne

Trees are like wood...
Sep 6 '07 #2
barry07
47
You can't use a SELECT query to insert a value into a field. In your case you should use the Dmin function as follows:

Expand|Select|Wrap|Line Numbers
  1. dkeylock=DMin("dkey","VetAbsorptie")
Sep 6 '07 #3
Twanne
65
Ok, thanks for all the response :p

Found a solution but it is a bit rude:

When you open the form, you can ad a procedure on load. In this procedure I say what the default value for the field is. I had hoped it wouldn't be necessary to write it in vba because I know it is possible from within acces itself.

Didn't find it but if anyone knows the answer I'd like to know it because it closes down my application. Users might mess with code, but they will have a harder time to figure out where the default value is inputed in access itself (no axtra traces). Plus I noticed when you call the Min() function it sometimes failes and makes my db crash :s

Greetz
Twanne

[watch the language - you can get your account banned doing this]

Ps. I wrote this while the solution was handed :D
Sep 6 '07 #4
Twanne
65
Sorry to break down your solution (it probably works but I don't know exactly how), but it doesn't work here.

Btw. I'm talking about when you right click on a field, then select properties (I think, my access is in dutch), there is a field to specify your default value. DMin("dkey","whatever my table name is") doesn't work there.

Greetz

Twanne

Hit the floor at 300 Mph and bounce back
Sep 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
3
by: Nick Truscott | last post by:
<? // scoreinput.php - input a match score when match selected from list ?> <html> <head> <basefont face="Verdana"> </head> <body>
7
by: Bob | last post by:
Currently I am using this statement to translate 3 fields in my db thru Visual Basic. I import the data from one table to another then call the IFF statements and the NewDate to translate the...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a table, tblCustomers, with fields SalutationID and Firstname. I made a query, qrySelect = "Select FirstName from tblCustomers Where SalutationID = " If I run this query by...
3
by: Matthew Kramer | last post by:
How would be the best way to do this in Access? I have two tables. The first table has all the rows of data. The first column of this table has a country name, the second has a year and the...
2
by: Fendi Baba | last post by:
I created a person table with various fields such as Suffix, Salutation, etc, Some of these fields may not be mandatory for example suffix. In the actual table itself, I only have a field for...
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
7
by: servantofone | last post by:
I'm using Access 2003. I'm building a query and wish to display all records with values in a certain field (HIST) made up of all zeros. The field has a range of text values including alpha-numeric...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.