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

querying values in a forms subform

I'm having trouble creating a query using an msaccess adp with an sql backend.

I have a form with a subform, within the subform I have a button which runs a query, the query then should get the ID value from the sub form, I have tried everything, the closest I could come is:

SELECT ID, Name, IPAddress, Manufacturer, AssetTag, Type, SerialNumber, Dept, Model, Location, Processor, MemoryType, HardDrive, CDType, Owner, CurrentCondition, DateLastChecked, MAC
FROM dbo.Data
WHERE (ID = @Forms_Location__Location_Subform__ID)

according to microsoft this is the correct syntax, however when the query is run I get the following popup:

enter parameter value : Forms_Location__Location_Subform__ID

If I enter a valid ID value then the query returns the correct data, I'm presaumning the query doesn't know where to get the parameter value from.

Can anyone help please.

PS when creating queries in adp projects I can't select a form value, using their wizard, why is this?
May 10 '06 #1
1 1329
CaptainD
135 100+
Usually when I create a query I run it through a msgbox to see if my query to the database is as it should be.

Also, Where does "@Forms_Location__Location_Subform__ID" come from and have you checked the value it gives. ID fields are usually integers, is that what you are passing.

In your case, to see what you are trying to pass.
Expand|Select|Wrap|Line Numbers
  1. Dim strSql as string
  2. strSql = "SELECT ID, Name, IPAddress, Manufacturer, AssetTag, Type, SerialNumber, Dept, Model, Location, Processor, MemoryType, HardDrive, CDType, Owner, CurrentCondition, DateLastChecked, MAC
  3. FROM dbo.Data
  4. WHERE (ID = @Forms_Location__Location_Subform__ID)"
  5.  
  6. MsgBox strSql
  7.  
My guess is, you will not be passing an integer to the query and, the "@" symbol is used in MS SQL Server stored procedure for parameters, they're not usually (Or you can't, don't know) used for fields or variables in Access.

Put your SQL string in a message box and see what it looks like, you should see the problem.
May 11 '06 #2

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

Similar topics

7
by: Gertjan van Heijst | last post by:
Hi, I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store...
1
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
1
by: ChadDiesel | last post by:
I'm new to access and need some help. I have a form with a shipment destination at the top. I then have a subform that I enter boxes for that shipment. I have several shipments going at a...
2
by: Manystrengths | last post by:
Hello all. Briefly described this is the problem I am having. I have a form, with a related subform. On the subform I want to enter the expiration date based on criteria in the main form. I...
1
by: Chippy | last post by:
I am having trouble working out how to update a field on an open form with a calculation based upon calculations from other tables! For example, I have 3 tables: Diary Diary_ID: autonum,...
2
by: dBNovice | last post by:
Hi all! I have 3 separate forms: Tasks, Subtasks, and Elements. All 3 is related by TaskId and Subtasks and Elements are related by SubtaskID. In the DB after I add a task, I want to be able to...
33
Cintury
by: Cintury | last post by:
Ok the problem originally started with me wanting to compare the dates entered on one form with the dates entered on a different form's subform (I hope that wasn't too confusing). Thru numerous...
4
by: paulw4 | last post by:
I have a mail form that has a datasheet subform, there can be up to sixty items in the datasheet. The data sheet has three fields: AttID, AttName, AttYN The object is for the enduser to select...
11
by: svdoerga | last post by:
Hello! I have a question I've been working on for a few days now and I can't find a solution. I hope there is someone that has the answer :) I'm using Access 2003 in win XP. I have a main form...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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
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...

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.