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

run time error 424 object required

Debug stops at the 3rd line of this code (Set rs =
db.openrecordset("IMPORT") why?
Private Sub Command118_Click()
Dim rs As DAO.Recordset
Set rs = db.openrecordset("IMPORT")
With rs
.MoveFirst
prev = !NOM_ACCOUNT
.MoveNext
Do
Select Case prev
Case "1700"
If !NOM_ACCOUNT <> "2300" Then
MsgBox "There has been an error in row # " & !NOM_ID & vbCrLf &
"Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "2300"
If !NOM_ACCOUNT <> "3200" Then
MsgBox "There has been an error in row # " & !NOM_ID & vbCrLf &
"Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "3200"
If !NOM_ACCOUNT <> "1700" Then
MsgBox "There has been an error in row # " & !NOM_ID & vbCrLf &
"Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
End Select
prev = !NOM_ACCOUNT
.MoveNext
Loop Until .EOF
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub

--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk
Nov 12 '05 #1
3 31952
HJ
You should declare db as well.

Private Sub Command118_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set rs = db.openrecordset("IMPORT")
....

HJ
"Lapchien" <cc****@NOSPAMeclipse.co.uk> wrote in message
news:10***************@ananke.eclipse.net.uk...
Debug stops at the 3rd line of this code (Set rs =
db.openrecordset("IMPORT") why?
Private Sub Command118_Click()
Dim rs As DAO.Recordset
Set rs = db.openrecordset("IMPORT")
With rs
.MoveFirst
prev = !NOM_ACCOUNT
.MoveNext
Do
Select Case prev
Case "1700"
If !NOM_ACCOUNT <> "2300" Then
MsgBox "There has been an error in row # " & !NOM_ID & vbCrLf &
"Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "2300"
If !NOM_ACCOUNT <> "3200" Then
MsgBox "There has been an error in row # " & !NOM_ID & vbCrLf &
"Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "3200"
If !NOM_ACCOUNT <> "1700" Then
MsgBox "There has been an error in row # " & !NOM_ID & vbCrLf &
"Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
End Select
prev = !NOM_ACCOUNT
.MoveNext
Loop Until .EOF
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub

--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk

Nov 12 '05 #2
HJ wrote:
You should declare db as well.

Private Sub Command118_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set rs = db.openrecordset("IMPORT")
I think you should set it as well;

Set db = Currentdb()


HJ
"Lapchien" <cc****@NOSPAMeclipse.co.uk> wrote in message
news:10***************@ananke.eclipse.net.uk...
Debug stops at the 3rd line of this code (Set rs =
db.openrecordset("IMPORT") why?
Private Sub Command118_Click()
Dim rs As DAO.Recordset
Set rs = db.openrecordset("IMPORT")
With rs
.MoveFirst
prev = !NOM_ACCOUNT
.MoveNext
Do
Select Case prev
Case "1700"
If !NOM_ACCOUNT <> "2300" Then
MsgBox "There has been an error in row # " & !NOM_ID &
vbCrLf & "Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "2300"
If !NOM_ACCOUNT <> "3200" Then
MsgBox "There has been an error in row # " & !NOM_ID &
vbCrLf & "Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "3200"
If !NOM_ACCOUNT <> "1700" Then
MsgBox "There has been an error in row # " & !NOM_ID &
vbCrLf & "Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
End Select
prev = !NOM_ACCOUNT
.MoveNext
Loop Until .EOF
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub

--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk


Nov 12 '05 #3
HJ
Yes, you are right. Forgot to mention that.

HJ

"Deano" <ma************@hotmail.com> wrote in message
news:Dz*******************@wards.force9.net...
HJ wrote:
You should declare db as well.

Private Sub Command118_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set rs = db.openrecordset("IMPORT")


I think you should set it as well;

Set db = Currentdb()


HJ
"Lapchien" <cc****@NOSPAMeclipse.co.uk> wrote in message
news:10***************@ananke.eclipse.net.uk...
Debug stops at the 3rd line of this code (Set rs =
db.openrecordset("IMPORT") why?
Private Sub Command118_Click()
Dim rs As DAO.Recordset
Set rs = db.openrecordset("IMPORT")
With rs
.MoveFirst
prev = !NOM_ACCOUNT
.MoveNext
Do
Select Case prev
Case "1700"
If !NOM_ACCOUNT <> "2300" Then
MsgBox "There has been an error in row # " & !NOM_ID &
vbCrLf & "Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "2300"
If !NOM_ACCOUNT <> "3200" Then
MsgBox "There has been an error in row # " & !NOM_ID &
vbCrLf & "Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
Case "3200"
If !NOM_ACCOUNT <> "1700" Then
MsgBox "There has been an error in row # " & !NOM_ID &
vbCrLf & "Validation failed", , "Error"
Exit Sub 'or Exit Function
End If
End Select
prev = !NOM_ACCOUNT
.MoveNext
Loop Until .EOF
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub

--
Thanks,
Chris
cc****@NOSPAMeclipse.co.uk


Nov 12 '05 #4

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

Similar topics

4
by: Oli | last post by:
Hi Hope someone can help: <% set rsProdInfo = Server.CreateObject("ADODB.Recordset") rsProdInfo.Open "TBL_Products", Conn intTotal = 0
1
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
4
by: dubing | last post by:
Hi, Our webpage uses the following JavaScript code. function toggleSubmenu(divId, link) { var div = document.getElementById(divId); div.style.display = (div.style.display == 'block') ?...
1
by: Andrew Phillipo | last post by:
I have some code that works everywhere but IE5.0, including IE5.5. Here is a snippet of where the code seems to go wrong: Location.prototype.change = function(current) { this.current = current;...
2
by: rahuldb111 | last post by:
<script language="javascript"> function mmLoadMenus() { if (window.mm_menu_0405153337_0) return; window.mm_menu_0405153337_0 = new...
3
by: rathiagu | last post by:
the below is my part of set cn = Server.CreateObject("ADODB.Connection") strCS = "Provider=System.Data.SqlClient; Data Source=" & _ Server.MapPath("management.mdb")& ";" cn.open strCS
2
by: Vbbeginner07 | last post by:
Please check the following code for adding records to a database: Im getting the error:object required in the following code( which is in bold letters) kindly go through Private Sub...
3
by: ShyamKrishnegowda | last post by:
We are writing test scripts to our product. In one of the script we are facing an issue. This test script will create a COM component and executes the following function. O1 and O2 are out...
1
by: ShyamKrishnegowda | last post by:
We are writing test scripts to our product. In one of the script we are facing an issue. This test script will create a COM component and executes the following function. O1 and O2 are out...
1
by: freefony | last post by:
i built a shopping software for a customer its working perfectly on my system but when i transferred to my customer's old desktop system this script throws error "object required" i tried Flock...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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.