473,566 Members | 3,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Whats wrong with this piece of code II

It' me again. What I forgot to say, stops with a runtime error (insert,
delete, update or select expected; the error number is a very low number
starting with -).

I have another problematic code here:

Sub retrieve()
Dim rst As ADODB.Recordset
Dim cmd As ADODB.Command
Dim prm As ADODB.Parameter
Dim i, j As Integer

Set cmd = New ADODB.Command
Set prm = New ADODB.Parameter

cmd.ActiveConne ction = CurrentProject. Connection
cmd.CommandText = "qryVintagerPar am"

prm.Type = adInteger
prm.Direction = adParamInput
prm.Value = 2

cmd.Parameters. Append prm

Set rst = cmd.Execute(j, prm)

i = rst.RecordCount

MsgBox "Count: " & i
End Sub

Again, qryVintagerPara m is predefined query. The definition includes a
parameter.

Thanks for your help!

Regards,
Jochen
Nov 12 '05 #1
2 1340
"asdf" <as**@asdf.co m> wrote in news:3f89966e$0 $234
$4*******@read. news.ch.uu.net:
cmd.ActiveConne ction = CurrentProject. Connection


You forgot the "set" here. Connection is an object, not a string.

set cmd.ActiveConne ction = CurrentProject. Connection
Nov 12 '05 #2
Success!

Thanks for this fast answer!
"Ross Presser" <rp******@NOSPA M.imtek.com.inv alid> schrieb im Newsbeitrag
news:Xn******** **************@ 129.250.170.91. ..
"asdf" <as**@asdf.co m> wrote in news:3f89966e$0 $234
$4*******@read. news.ch.uu.net:
cmd.ActiveConne ction = CurrentProject. Connection


You forgot the "set" here. Connection is an object, not a string.

set cmd.ActiveConne ction = CurrentProject. Connection

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1849
by: Fendi Baba | last post by:
Hi everyone, I am new to php. I am using a piece of code which is testing if a certain variable is <=0. and the code is written as follows: $lc_align = 'center'; if ($listing<=0) { $lc_text = tep_image_button('button_buy_now_na.gif', IMAGE_BUTTON_BUY_NOW_NA) . '&nbsp;'; } else { $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF),
3
2385
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."', '".$_POST."')"); ?> <script language="JavaScript"> <!--
62
3687
by: TheShadow1 | last post by:
safetyTips - this array is in here.js ...
4
4059
by: asdf | last post by:
Hello! Can someone tell me whats wrong with this piece of code: Option Compare Database Option Explicit Sub retrieve() Dim rst As ADODB.Recordset Dim i As Integer
3
2037
by: mahsa | last post by:
Hi do you know whats wrong with this code? <asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');" %>'>Need Help?</asp:HyperLink> -- mahsa
7
2220
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell me why? Its probably sooooooo obvious, but it is 1.19 am! Thanks. www.thunderin.co.uk/
16
1895
by: SirG | last post by:
I'm looking for an explanation of why one piece of code works and another does not. I have to warn you that this is the first piece of Javascript I've ever written, so if there is a better way or a simpler answer, by all means show me the light! What I'm trying to do is refresh the page at a timed interval ( actually redirect the page... )...
19
2121
by: Steve | last post by:
I have to create 2 strings and then parse one string out to save the data into the database. My first string looks like this: John|Smith|Jsmith@yahoo.com,Greg|Henry|gh@aol.com,Kelly|Smith|ks@gmail.com, I then need to parse out that string to seperate them by the commas so I see this John|Smith|Jsmith@yahoo.com
5
2311
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just the number. whats wrong with my code? #!/usr/bin/perl use Fcntl; @array = (a..z); srand; foreach (1..5) { $name = int(rand...
0
7683
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...
0
7899
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. ...
0
8113
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7649
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...
0
7957
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...
0
6270
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5487
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5215
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...
1
2092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.