Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

please amend this code

Posted on 2002-07-29
4
Medium Priority
?
174 Views
Last Modified: 2010-05-02
Hi,


the following code gives me this error: "Object variable or with block variable not set "

Private Sub Form_Load()
Dim SsqlD  As String


SsqlD = "DELETE * FROM Table1”

Me.Adodc1.LockType = adLockOptimistic
Me.Adodc1.Recordset.Source. = SsqlD

please help by amending this code

asns
0
Comment
Question by:asns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7184827
I think you should bind the recordset's recordsource to a recordset and not a string as you are doing. Try making the following changes:


Private Sub Form_Load()
Dim SsqlD  As String
SsqlD = "DELETE * FROM Table1”
Me.Adodc1.Recordset.Source. = SsqlD
Me.Adodc1.Refresh
End sub
-priya

0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7184831
sorry this line ..
Me.Adodc1.Recordset.Source. = SsqlD

should be..
Me.Adodc1.RecordSource = SsqlD
and then the refresh thing..

hope this helps
-priya
0
 
LVL 2

Accepted Solution

by:
priya_pbk earned 200 total points
ID: 7184840
>>I think you should bind the recordset's recordsource to a recordset and not a string as you are doing. Try making the following changes:<<

Pls ignore this in the first suggestion, i was trying somthing else first.

Just to avoid confusion, the code will be:

Private Sub Form_Load()
Dim SsqlD  As String
SsqlD = "DELETE * FROM Table1”
Me.Adodc1.RecordSource = SsqlD
Me.Adodc1.Refresh
End sub

-priya
0
 
LVL 3

Expert Comment

by:sanjaykattimani
ID: 7184868
If you have connection object

ConDb.Execute("DELETE * FROM Table1")

will do the needful.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question