Text in ROWS desn't visible =( |
Post Reply |
Author | |
nmihail
Newbie Joined: 02 March 2008 Location: Russian Federation Status: Offline Points: 5 |
Post Options
Thanks(0)
Posted: 02 March 2008 at 7:30pm |
uploads/20080307_095846_concrete_WITHOU.zipuploads/20080307_054103_concrete.zipPlease Help Me. Rows added, but data invisible (empty rows). Another control (textbox, list) shows text correctly. I use a few repotrcontrols, one shows data, but others don't. I show a part of code. The same code used by all reportcontrols. How could data be visible?
-------------------
Public adoRS As New ADODB.Recordset
Public adoCN As New ADODB.Connection Public sSource As String Public sConn As String Public strSql As String Public Record As ReportRecord Public pItem As ReportRecordItem Private Sub Fill ()
strSql = "SELECT * FROM tab_carcompaniescontacts WHERE idcarcompany=1;"
adoCN.Open sConn adoRS.Open strSql, adoCN, adOpenKeyset, adLockOptimistic Do While Not adoRS.EOF With ReportCarCompanyContacts Set Record = ReportCarCompanyContacts.Records.Add Set pItem = Record.AddItem(adoRS.Fields.Item("id").Value) Record.AddItem (adoRS.Fields.Item("contact").Value) Record.AddItem (adoRS.Fields.Item("tel").Value) End With 'Get the next record. adoRS.MoveNext Loop ReportCarCompanyContacts.Populate adoRS.Close adoCN.Close End Sub
--------------------
|
|
Bernie
Senior Member Joined: 05 July 2007 Location: Taiwan Status: Offline Points: 109 |
Post Options
Thanks(0)
|
DIm Tmp
Tmp = adoRS.Fields.Item("contact").Value
Record.AddItem Tmp
I don't know why
but these codes can work!!!
|
|
Bernie Ho, Planning Manager + IELTS specialist + part-time programmer
Taiwan, R.O.C |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Try this:
Record.AddItem (CStr(adoRS.Fields.Item("contact").Value)) |
|
nmihail
Newbie Joined: 02 March 2008 Location: Russian Federation Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Very strange, but data invisible yet
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Hm. Try this:
Do While Not adoRS.EOF With ReportCarCompanyContacts Set Record = ReportCarCompanyContacts.Records.Add Set pItem = Record.AddItem(adoRS!ID) set pItem = Record.AddItem (adoRS!contact) set pItem = Record.AddItem (adoRS!tel) End With 'Get the next record. adoRS.MoveNext Loop ReportCarCompanyContacts.Populate |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Oops. Small alteration. Don't forget to make them Record.AddItem(CStr(...
|
|
nmihail
Newbie Joined: 02 March 2008 Location: Russian Federation Status: Offline Points: 5 |
Post Options
Thanks(0)
|
The same situation. Not visible.
I have uploaded source. May be i made mistake. Please see it.
the source is original without modified code according this forum/ but i tried it.
the table in frmNewCarcompany.frm must show info from mdb.
table in frmCarcompanies.frm shows correctly.
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
I can't load the project. I don't have DBGrid. Can you send one without that grid?
|
|
nmihail
Newbie Joined: 02 March 2008 Location: Russian Federation Status: Offline Points: 5 |
Post Options
Thanks(0)
|
https://forum.codejock.com/uploads/20080307_095846_concrete_WITHOU.zip
Project without DBGrid
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Got it! You should be able to figure out the other places changes need to be made based on the following changes:
Public Const CARCOMPANY_PERSON_NUMBER = 0 Public Const CARCOMPANY_PERSON_NAME = 1 Public Const CARCOMPANY_PERSON_PHONE = 2 Public Sub SelectedCarcompanyShowContacts(index As Integer) sSource = AddBackslash(App.Path) & "\db.mdb" sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sSource & ";Persist Security Info=False;Jet OLEDB:database Password=" '---------------------------------------- strSql = "SELECT * FROM tab_carcompaniescontacts WHERE idcarcompany=" & index & ";" adoCN.Open sConn adoRS.Open strSql, adoCN, adOpenKeyset, adLockOptimistic With frmNewCarcompany.ReportCarCompanyContacts .Records.DeleteAll Do While Not adoRS.EOF Set Record = .Records.Add() Set pItem = Record.AddItem(CStr(adoRS!Id)) Set pItem = Record.AddItem(CStr(adoRS!contact)) Set pItem = Record.AddItem(CStr(adoRS!Tel)) 'Get the next record. adoRS.MoveNext Loop .Populate End With adoRS.Close adoCN.Close End Sub |
|
nmihail
Newbie Joined: 02 March 2008 Location: Russian Federation Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Thank you. Now it works.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |