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

Populate a continuous form using ADO

Hi there, I am trying to populate a continuous form using ADO, following is
the function which needs fixing, can someone kindly help me with this.
Thanks much

Private Sub Form_Load()

On Error GoTo err_Form_Load
Dim objRstADO As ADODB.Recordset
Dim sqlstr As String
Dim tZone As String

If PostgreSQLADOConnection() Then

tZone = "set timezone to 'GMT'; set datestyle to 'ISO'; " & _
"select version(), case when pg_encoding_to_char(1) =
'SQL_ASCII' " & _
"then 'UNKNOWN' else getdatabaseencoding() end"
cPostgreSQL.Execute tZone

sqlstr = "Select a.id, a.name, count(*) as count " & _
"FROM tblcustomer a, tblorder b " & _
"WHERE a.order_id=b.id " & _
"GROUP BY 1,2 " & _
"ORDER BY 3 DESC"
Set objRstADO = cPostgreSQL.Execute(sqlstr, , adLockReadOnly)

Set Me.Recordset = objRstADO

Do While Not objRstADO.EOF

objRstADO.MoveNext
Me.txtID = objRstADO("id")
Me.txtName = objRstADO("name")
Me.txtCount = objRstADO("count")
Loop

objRstADO.Close
Set objRstADO = Nothing

Else
MsgBox "Connection error: Could not execute"
End If
Exit Sub

err_Form_Load:
MsgBox Err.Number & " - " & Err.Description, vbOKOnly
End Sub

Nov 12 '05 #1
1 2971
For one thing, you shouldn't need the loop at the end populating your
controls.
Setting the Recordset property of your form should be sufficient.

Also, you haven't specified what behavior you're getting here, so I don't
know exactly what you want but aren't getting.
But I would be very surprised if this SQL returned a recordset which was
updatable.

HTH
- Turtle

"tmuhammad" <tm*******@rogers.com> wrote in message
news:MY********************@news04.bloor.is.net.ca ble.rogers.com...
Hi there, I am trying to populate a continuous form using ADO, following is the function which needs fixing, can someone kindly help me with this.
Thanks much

Private Sub Form_Load()

On Error GoTo err_Form_Load
Dim objRstADO As ADODB.Recordset
Dim sqlstr As String
Dim tZone As String

If PostgreSQLADOConnection() Then

tZone = "set timezone to 'GMT'; set datestyle to 'ISO'; " & _
"select version(), case when pg_encoding_to_char(1) =
'SQL_ASCII' " & _
"then 'UNKNOWN' else getdatabaseencoding() end"
cPostgreSQL.Execute tZone

sqlstr = "Select a.id, a.name, count(*) as count " & _
"FROM tblcustomer a, tblorder b " & _
"WHERE a.order_id=b.id " & _
"GROUP BY 1,2 " & _
"ORDER BY 3 DESC"
Set objRstADO = cPostgreSQL.Execute(sqlstr, , adLockReadOnly)

Set Me.Recordset = objRstADO

Do While Not objRstADO.EOF

objRstADO.MoveNext
Me.txtID = objRstADO("id")
Me.txtName = objRstADO("name")
Me.txtCount = objRstADO("count")
Loop

objRstADO.Close
Set objRstADO = Nothing

Else
MsgBox "Connection error: Could not execute"
End If
Exit Sub

err_Form_Load:
MsgBox Err.Number & " - " & Err.Description, vbOKOnly
End Sub

Nov 12 '05 #2

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

Similar topics

3
by: Prakash Wadhwani | last post by:
Is there any EASY way to highlight a full row in a continuous form so that as i navigate up & down the table/continuous form using the arrow keys, the entire line (all fields) get highlighted ? ...
3
by: Damian | last post by:
Hi. Is there a way to programatically populate a continuous form? I have an array of descriptions that I want to display in the continuous form and I have a textbox on the form called...
3
by: Mark | last post by:
Hi there, I have a subform, set as a continuous form. When a user selects a particular record in that subform, how can I make that particular record stand out (color or font change, size, etc) from...
3
by: David | last post by:
Hi, I need a button shown for each record (cont. form) with specific captions on each. I have a notes form for each record. When a user presses the button they can read the notes. I want to...
3
by: Richard Hollenbeck | last post by:
I have the following query in my form's code: Private Function Get_Data(fieldNum As Integer) Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset strSQL = "SELECT & "", "" & ...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
1
by: monsey11 | last post by:
Hi all, I'm racking my brain to come with an idea for a form. here are the requirements: its for a custom quilt manufacturer and on each quilt order there may be added many customizable...
5
by: Desmond Shek | last post by:
Hi, I am new to this DB caper and am really struggling. I have a form called customers with a subform called property search. The subform (a continuous form) allows users to search the table...
13
by: eighthman11 | last post by:
using Access 2003 and sql server version 8.0 Hey everyone. Created a text box where the user types in an Inventory number and it takes them to that inventory number on the contimuous form. The...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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...

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.