Hi,
Could you please tell me why iam getting this error (Run time error '424' object required)
Im trying to display data from 3 tables(customer02,account03 and transaction02) using a grid for the transaction02 data.
Thank you.
Shananne -
Dim db1 As DAO.database
-
Dim rs1 As DAO.Recordset 'Account02
-
Dim rs2 As DAO.Recordset ' Transaction
-
-
Private Sub Form_Load()
-
Show
-
'set up the grid
-
Grid1.Row = 0
-
Grid1.ColWidth(0) = 1500
-
Grid1.ColWidth(1) = 850
-
Grid1.ColWidth(2) = 800
-
Grid1.Col = 0
-
Grid1.Text = "Transaction_no"
-
Grid1.Col = 1
-
Grid1.Col = "Transaction date"
-
Grid1.Col = 2
-
Grid1.Text = "Amount"
-
'Open the database
-
Set db1 = OpenDatabase("Bank.mdb")
-
'Database is in same folder as this application.
-
'create Account02 recordeset rs1
-
x$ = "Select customer02.*,account_no,date,amount"
-
x$ = x$ & "from Customer02, Account02"
-
x$ = x$ & "where C_no = account_no"
-
x$ = x$ & "order by C_no, date"
-
Set rs1 = db1.OpenRecordset(x$, dbOpenSnapshot)
-
display_customer02_account02_transaction02 'call the subroutine
-
End Sub
-
-
Private Sub display_customer02_account02_transaction02()
-
Picture1.Cls
-
Picture1.Print "Bank no: " & rsMyRS1!C_no
-
Picture1.Print rs1!Title & " " & rs1!initials & " " & rs1!surname
-
Picture1.Print rs1!city
-
Picture1.Print rs1!postc
-
Label1.Caption = rs1!Account_no
-
Label2.Caption = rs1!Date
-
'Clear the grid
-
For i = 1 To 10
-
Grid1.Row = i
-
For j = 0 To 2
-
Grid1.Col = j
-
Grid1.Text = ""
-
Next j
-
Next i
-
'Retrieve set of transactions02 for current account_no
-
x$ = "select transaction_no, transaction date, amount"
-
x$ = x$ & "from Transaction02"
-
x$ = x$ & "where Account_no ="
-
x$ = x$ & rs1!Account_no
-
Set rs2 = db1.OpenRecordset(x$, dbOpenSnapshot)
-
'Display transactions
-
If rs2.RecordCount > 0 Then
-
Grid1.Row = 0
-
Do While Not rs2.EOF
-
Grid1.Row = Grid1.Row + 1
-
Grid1.Col = 0
-
Grid1.Text = rs2!transaction_no
-
Grid1.Col = 1
-
Grid1.Text = rs2!Transaction = 2
-
Grid1.Text = rs2!amount
-
rs2.MoveNext
-
Loop
-
End If
-
End Sub
-
Private Sub Command1_Click()
-
If rs1.EOF Then Exit Sub
-
rs1.MoveNext
-
If rs1.EOF Then Exit Sub
-
'Display current account02 details
-
display_customer02_account02_transaction02 'call this procedure subroutine
-
End Sub
-
2 1802 - Dim db1 As DAO.database
-
Dim rs1 As DAO.Recordset 'Account02
-
Dim rs2 As DAO.Recordset ' Transaction
-
-
Private Sub Form_Load()
-
Show
-
'set up the grid
-
Grid1.Row = 0
-
Grid1.ColWidth(0) = 1500
-
Grid1.ColWidth(1) = 850
-
Grid1.ColWidth(2) = 800
-
Grid1.Col = 0
-
Grid1.Text = "Transaction_no"
-
Grid1.Col = 1
-
Grid1.Col = "Transaction date"
-
Grid1.Col = 2
-
Grid1.Text = "Amount"
-
'Open the database
-
Set db1 = OpenDatabase("Bank.mdb")
-
'Database is in same folder as this application.
-
'create Account02 recordeset rs1
-
x$ = "Select customer02.*,account_no,date,amount"
-
x$ = x$ & "from Customer02, Account02"
-
x$ = x$ & "where C_no = account_no"
-
x$ = x$ & "order by C_no, date"
-
Set rs1 = db1.OpenRecordset(x$, dbOpenSnapshot)
-
display_customer02_account02_transaction02 'call the subroutine
-
End Sub
-
-
Private Sub display_customer02_account02_transaction02()
-
Picture1.Cls
-
Picture1.Print "Bank no: " & rsMyRS1!C_no
-
Picture1.Print rs1!Title & " " & rs1!initials & " " & rs1!surname
-
Picture1.Print rs1!city
-
Picture1.Print rs1!postc
-
Label1.Caption = rs1!Account_no
-
Label2.Caption = rs1!Date
-
'Clear the grid
-
For i = 1 To 10
-
Grid1.Row = i
-
For j = 0 To 2
-
Grid1.Col = j
-
Grid1.Text = ""
-
Next j
-
Next i
-
'Retrieve set of transactions02 for current account_no
-
x$ = "select transaction_no, transaction date, amount"
-
x$ = x$ & "from Transaction02"
-
x$ = x$ & "where Account_no ="
-
x$ = x$ & rs1!Account_no
-
Set rs2 = db1.OpenRecordset(x$, dbOpenSnapshot)
-
'Display transactions
-
If rs2.RecordCount > 0 Then
-
Grid1.Row = 0
-
Do While Not rs2.EOF
-
Grid1.Row = Grid1.Row + 1
-
Grid1.Col = 0
-
Grid1.Text = rs2!transaction_no
-
Grid1.Col = 1
-
Grid1.Text = rs2!Transaction = 2
-
Grid1.Text = rs2!amount
-
rs2.MoveNext
-
Loop
-
End If
-
End Sub
-
Private Sub Command1_Click()
-
If rs1.EOF Then Exit Sub
-
rs1.MoveNext
-
If rs1.EOF Then Exit Sub
-
'Display current account02 details
-
display_customer02_account02_transaction02 'call this procedure subroutine
-
End Sub
Specify what line that error occurs. I have no idea with DAO, but I guess you need to add the keyword New - Dim db1 As New DAO.database
-
Dim rs1 As New DAO.Recordset 'Account02
-
Dim rs2 As New DAO.Recordset ' Transaction
Ooops, at line 37, you need to replace the name of your field. (Note: Date is a datatype) : )
Hi
Just call this line in this function "display_customer02_account02_transaction02()" instead of Form load event.
Set rs1 = db1.OpenRecordset(x$, dbOpenSnapshot)
It will work.
musai.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sarah Tanembaum |
last post by:
I was wondering if it is possible to create a secure database system
using RDBMS(MySQL, Oracle, SQL*Server, PostgreSQL etc) and web
scripting/programming language(Perl, PHP, Ruby, Java, ASP, etc)...
|
by: cooldv |
last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and
Access 2000 database. (with a hosting company)
traffic is slow at this time but expect to grow. lately i have been
reading...
|
by: MHenry |
last post by:
Hi,
We were going merrily along for 6 years using this database to record
all client checks that came into our office, including information
about what the checks were for.
Suddenly, network...
|
by: premmehrotra |
last post by:
I currently have a multi-user access database which is put on a shared
drive L: on a Windows Servers. Entire database is one file premdb.mdb.
Users access this database from their laptops....
|
by: John Baker |
last post by:
Hi:
I am URGENTLY in need of some book or web site OR tool that will help me integrate a
relatively simple access application into a web page or pages. This is a time recording
system (by...
|
by: Claus Haslauer |
last post by:
Hi,
firstly, I am new to access03 and server03
Originally, I had written an access 2002 database.
Then, we transferred (for another reason) to server 2003.
Then, we got access 2003.
Then I...
|
by: philip |
last post by:
On a form, I have a datagridview.
This datagridview is constructed on a dataset filled by a tableadapter.
The table adapter do very well what it must do when filling dataset.
Insertions,...
|
by: Allison |
last post by:
Hi -- we are a small manufacturing looking for a multi-user database to
take customer orders (nothing too complicated, with 3 users total). We
think we should be using Access, but are wondering...
|
by: surfrat_ |
last post by:
Hi,
I am having the following problems in getting Microsoft Visual Studio
2005 Professional to link to an Access .mdb
database. Please help me to sort this out.
Problem 1:
The Microsoft...
|
by: nihad.nasim |
last post by:
Hi there,
I have a database in Access that I need on the web. The web page
should connect to the database and write records for certain tables
and view records for others. I want to know a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |