|
-
Dec 10th, 2001, 03:43 PM
#1
Thread Starter
Lively Member
Query
How to pass parametar to Access query. when I open query in Access it ask me to enter parametar but I don't know how to pass it from VB
-
Dec 11th, 2001, 04:37 AM
#2
Hyperactive Member
When you have to add a parameter in a Query in Access it means that not all the information you use to create the query is available. I don't think you're able to pass a parameter with VB (forgive me if I'm wrong)
I would use the following to solve this problem:
Remove the missing parameter from your query, or
create a new table for that parameter and fill it using VB, or
run the SQL inside VB and add the parameter over there.
One of the ways to receive that message is to create a query i.e.
length, width, price/m2.
Add a calculated field
area : [length] * [width] and WITHOUT saving use the calculated field to recalculate a new field:
Total : [area] * [price/m2]
If you save the query between the calculated fields it works fine
-
Dec 11th, 2001, 10:31 AM
#3
Fanatic Member
No, that's not the way.
You can pass parameters for a parameter query from VB. You can use the Command object's parameter collection in ADO.
Assuming the connection string/objects are set up
Dim objCmd as new ADODB.Command
Dim objRS asd ADODB.Recordset
Dim objParam new ADODB.Parameter
'an example of an ID parameter of type integer
Set objParam = objCmd.CreateParameter("ID", adInteger, adParamInput)
'append the parameter to the Command's parameter colletion.
objCmd.Append objParam
'execute the command
set objRS = objCmd.Execute("StoredQueryName")
VB 6.0, Access, Sql server, Asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|