473,656 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using a query for a standard value

65 New Member
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 1360
Twanne
65 New Member
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 New Member
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 New Member
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 New Member
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
10132
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
1943
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
35670
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 fields. Can this be done in an Access db? I am trying to learn how to do these things in Access vs Visual Dim strIIF As String Dim sstrIIF As String Dim strNewDate As Date
3
47334
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 itself, it works fine. It asks me for the parameter and then it shows the records . What I want is to be able to pass the parameter to it in VBA I am using the following code:
3
1511
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 third column is the data value. The second table is just a list of standard years ie. 1980, 1985, 1990, 1995). Is there a way to arrange a query so that all of the rows in table 1
2
2385
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 suffix ID where 1=Phd, 2= MD. To display all of these to the user, I created a form with an underlying query. The problem I am encountering is this, when we have an empty field, for example where ID="", the query returns nothing. How do i work around...
1
1960
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 the page are used to call itself with querystring values for brand, thinner, finish, etc. The page must show all colors if the querystring is empty and filter out records that don't match the querystring value when it's not. I've tried building...
21
34383
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 obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
7
2469
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 characters and may look as follows: "0000000" "10112B1A" "0000" "***111B001" "0000000000" "111000" "0" "00000000000"
0
8382
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8498
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8600
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.