473,395 Members | 1,956 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,395 software developers and data experts.

Using Query Results in a Form MS Access

2
I have two fields on a form called Employee Name and Employee Number. I would like the user to select their name and their coresponding number will appear in the Employee Number field.

The Employee Name field is a lookup from a table.
The Employee Number field is the result of a query.

The number field comes in at 0.

My query results look like the following:

Employee Name Employee Number
> Recieving 101
* 0

I think that the default value in the form is getting the zero from the autonumber field, which is also the index.

Does anyone have a suggestion?
Nov 9 '06 #1
9 3894
NeoPa
32,556 Expert Mod 16PB
We need to see the code you're using as well as the results to be able to see what may be wrong.
Check out this link for help in posting questions ( http://www.thescripts.com/forum/thread559246.html ).
Nov 9 '06 #2
gwww
2
SELECT EmpID.[Employee Name], EmpID.[Employee Number]
FROM EmpID
WHERE (((EmpID.[Employee Name])=[Forms]![Receiver]![Employee Name]));

the code above is the query code, and should only return one record. It returns both the correct record an additional entry with a value of 0. Just like the last visible record of a table when opened in access.

It is a basic select query and in the forms field "Employee Number" property box the default value is
[EmpID]![Employee Number] My understanding is that it should display the value from the query. But since the query has the second entry it is displaying the 0 from the unwanted second entry.

If I could figure out how to attach a screen shot it would be easier to understand.
Nov 9 '06 #3
NeoPa
32,556 Expert Mod 16PB
That's MUCH clearer gwww.
I must leave for home now but I'll look at this later, time permitting.
I now understand the issue :).
Nov 9 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
I think the 0 is actually appearing because you're returning the EmpID.[Employee Name] from the query. You don't need to.

Try this instead:

SELECT EmpID.[Employee Number]
FROM EmpID
WHERE (((EmpID.[Employee Name])=[Forms]![Receiver]![Employee Name]));
Nov 12 '06 #5
NeoPa
32,556 Expert Mod 16PB
Sorry, I must have overlooked this one yesterday.
Thanks to Mary for stepping in.
Nov 12 '06 #6
MMcCarthy
14,534 Expert Mod 8TB
Sorry, I must have overlooked this one yesterday.
Thanks to Mary for stepping in.
I know you went to bed really early last night. I had over 100 new posts to trawl through to make sure nothing was orphaned or inappropriate. So I was up a little late as usual. This site is getting so busy we'll have to work out a schedule so everyone can get a little sleep. <grin>

I'm surprised I was so articulate considering the time.

Mary
Nov 12 '06 #7
MMcCarthy
14,534 Expert Mod 8TB
I know you went to bed really early last night. I had over 100 new posts to trawl through to make sure nothing was orphaned or inappropriate. So I was up a little late as usual. This site is getting so busy we'll have to work out a schedule so everyone can get a little sleep. <grin>

I'm surprised I was so articulate considering the time.

Mary
BTW, there wasn't must to worry about. Thanks a million guys for covering.

Mary
Nov 12 '06 #8
NeoPa
32,556 Expert Mod 16PB
I know you went to bed really early last night. I had over 100 new posts to trawl through to make sure nothing was orphaned or inappropriate. So I was up a little late as usual. This site is getting so busy we'll have to work out a schedule so everyone can get a little sleep. <grin>

I'm surprised I was so articulate considering the time.

Mary
LOL
You were up after I went to bed young lady. You and your bed seem to be opposite ends of a magnet.

-Adrian.
Nov 12 '06 #9
MMcCarthy
14,534 Expert Mod 8TB
LOL
You were up after I went to bed young lady. You and your bed seem to be opposite ends of a magnet.

-Adrian.
Maybe I was born on the wrong side of the planet?
Nov 12 '06 #10

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

Similar topics

0
by: Kate Perry | last post by:
I am trying to execute a query on a db2 database using the dbi module. I'm wondering if someone can take a look at my code and tell me what I'm doing wrong. I'm assuming it's a problem with my...
0
by: david liu | last post by:
access 2000 query: here's what i want to do. from an asp page, perform a search on a table in access. i have used sql code in the asp page itself, but i'd rather execute a query in access. i...
6
by: CFW | last post by:
References in Access and .mdb files have always been painful for me - just when I thought I was OK in an .mdb, I have a .adp I'm working on and I need to use Set db as CurrentDb - Constant "object...
4
by: Mark | last post by:
HI All, As you can tell by the post, I am still in the early stages of learning VB so please bear with me. My question is, can you use the results of a SQL as a variable in code? Something...
4
by: Luisa Lopes | last post by:
Dear colleagues: I read somewhere that you could obtain the results of a query as a form. I have design a database for my books and waht I would like is to obtain the results of my queries...
0
by: sofakingfree | last post by:
Over the weekend I tested some new query logic in Access 2000 and it worked flawlessly. I get into work this morning and try it in Access 2003 and it completely deletes the WHERE criteria. Why in...
6
by: Brian | last post by:
Hello, Basically, I'm running a query on a form's activation, and I'd like to have the results of the query be placed into other fields on the same form automatically. Does anybody know how...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
10
by: sesling | last post by:
I have created a query that will pull information from our database for the operators. This query will pull in on average 50,000 records. The operators need to refine the search results. I have...
1
by: xcelmind | last post by:
Hello Dev. Guru, I want to at this time introduce myself. I am Stanley Ojadovwa by name. I’m a freelance and a newbie in web application development. I’m currently using ASP as my application...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.