hi Art,
please answer all the questions ... and make your own query to get the data, thanks!
have an awesome day,
crystal
I forgot...
The control is a picturebox (I have no idea why they would use that).
and the actual select statement from the vb6 code::
With Adodc1
.ConnectionString = connectionStrg
.RecordSource = "SELECT MainTitle.MainLevelTitle, eSubFolderTable.SubLevelOneName, " & _
"Document.DocumentName, MainTitle.IndexKey01, MainTitle.IndexKey02, " & _
"MainTitle.IndexKey03, MainTitle.IndexKey04, MainTitle.IndexKey05, " & _
"MainTitle.IndexKey06, MainTitle.IndexKey07, MainTitle.IndexKey08, " & _
"MainTitle.IndexKey09, MainTitle.IndexKey10, " & _
"Document.DocumentFileType, Document.CreatedDate, Document.CreatedTime, " & _
"Document.DocumentLocation, Document.DocumentFileKBSize, Document.DocGroup, " & _
"MainTitle.MainTitleKey, Document.SubLevelOneKey, Document.DocumentKey " & _
"FROM ((MainTitle LEFT JOIN Document ON [MainTitle].[MainTitleKey] " & _
"=[Document].[MainTitleKey]) LEFT JOIN eSubFolderTable ON [eSubFolderTable].[SubLevelOneKey] " & _
"=[Document].[SubLevelOneKey]) WHERE MainTitle.ArchiveKey ='" & archiveKey & "'"
With Warm Regards,Arthur D. LorenziniIT System ManagerCheyenne River Housing AuthorityWk.(605)964-4265 Ext. 130Fax (605)964-1070
"Valar Dohaeris"
On Sunday, September 17, 2017 03:00:39 PM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
hi Art,
the is very confusing. It seems that the data is not normalized as I see fields like IndexKey01, IndexKey02, ... IndexKey10. This is a not a good way to structure the information! The index keys should be in a related table with 0 to however many records are needed. That will make everything so much easier.
Also, the code is confusing -- is this VBA for Access?
What kind of control is being used? AFAIK, List Boxes in Access cannot address column properties like this. While the VB language VB is very much like VBA (Visual Basic for Applications), the normal Access controls are different -- for instance, with list boxes, captions are determined in the Row Source by assigning field aliases, widths are listed in Column Widths using a string delimited with semi-colon, Alignment can only be done using formulas to pad spaces (so, in other words, duct-tape!)
I also do not see the 'placeholder' values for the Yes/No values you mentioned in the SQL -- in fact, there is not even a WHERE clause, so ... did you create the query yourself?
At any rate, the database needs to be better structured. If this is a conversion, it is best to do that now.
have an awesome day,
crystal
On 9/17/17 1:13 PM, Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] wrote:
Private Sub Form_Load()
On Error GoTo EHTLR
'Set TDBList1.RowSource = Adodc1.Recordset
Me.TDBList1.Column(16).Visible = False
Me.TDBList1.Column(2).Style.Font.Bold = True
Me.TDBList1.Column(2).Style.BackColor = &H80000018
Me.TDBList1.Column(2).HeadingStyle.Font.Bold = True
' TDBList1.ColumnHeaders = False
' For i = 1 To 9
' If TDBList1.Columns(i + 2).Text = "IndexKey0" & i Then TDBList1.Columns(i + 2).Text = ""
' Next i
' If TDBList1.Columns(12).Text = "IndexKey10" Then TDBList1.Columns(12).Text = ""
' Hiding some columns
Me.TDBList1.Column(16).Visible = False
Me.TDBList1.Column(17).Visible = False
Me.TDBList1.Column(19).Visible = False
Me.TDBList1.Column(20).Visible = False
Me.TDBList1.Column(21).Visible = False
' setting column caption and the size:
' TDBList1.Columns(0).Width =
Me.TDBList1.Column(0).Caption = "eFolder"
Me.TDBList1.Column(1).Caption = "eSubFolder"
Me.TDBList1.Column(2).Width = 3000
Me.TDBList1.Column(13).Caption = "Type"
Me.TDBList1.Column(13).Width = 450
Me.TDBList1.Column(14).Width = 980
Me.TDBList1.Column(14).TextAlign = 1Me.TDBList1.Column(15).Width = 980
Me.TDBList1.Column(15).Alignment = 1
Me.TDBList1.Column(17).Caption = "Size(Bytes)"
Me.TDBList1.Column(17).Width = 850
Me.TDBList1.Column(17).Alignment = 3
Me.TDBList1.Column(18).Width = 840
Me.TDBList1.Column(18).Alignment = 1
EHTLR:
MsgBox "Error: " & Err.Number & "--" & Err.Description, , "Form_Load"
End Sub
But I end up with a object not found error when I run it....
SELECT tblMainTitle.MainLevelTitle, tbleSubFolderTable.SubLevelOneName, tblDocument.DocumentName, tblMainTitle.IndexKey01, tblMainTitle.IndexKey02, tblMainTitle.IndexKey03, tblMainTitle.IndexKey04, tblMainTitle.IndexKey05, tblMainTitle.IndexKey06, tblMainTitle.IndexKey07, tblMainTitle.IndexKey08, tblMainTitle.IndexKey09, tblMainTitle.IndexKey10, tblDocument.DocumentFileType, tblDocument.CreatedDate, tblDocument.CreatedTime, tblDocument.DocumentLocation, tblDocument.DocumentFileKBSize, tblDocument.DocGroup, tblMainTitle.MainTitleKey, tblDocument.SubLevelOneKey, tblDocument.DocumentKey
FROM (tblMainTitle LEFT JOIN tblDocument ON tblMainTitle.MainTitleKey = tblDocument.MainTitleKey) LEFT JOIN tbleSubFolderTable ON tblDocument.SubLevelOneKey = tbleSubFolderTable.SubLevelOneKey;
Sorry, Here is the SQL for the query rowsource...:
And as I looked around and I found this for adding properties for a list box so I played with it and came up with this:
With Warm Regards,Arthur D. LorenziniIT System ManagerCheyenne River Housing AuthorityWk.(605)964-4265 Ext. 130Fax (605)964-1070
"Valar Dohaeris"
On Saturday, September 16, 2017 04:18:49 PM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
hi Art,
make a query and assume the value of each of those checkboxes by using True or False in criteria for the query. Once you have done that, let us know what the SQL is and we can help you with the VBA to get there.
have an awesome day,
crystal
On 9/16/17 3:02 PM, Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals] wrote:
There is three checkboxes on another form called frmMain which are set when a user completes a series of actions. However those checkboxes are set will determine the rowsource of the list box on frmDocument list.
With Warm Regards,Arthur D. LorenziniIT System ManagerCheyenne River Housing AuthorityWk.(605)964-4265 Ext. 130Fax (605)964-1070
"Valar Dohaeris"
On Saturday, September 16, 2017 02:48:52 PM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
hi Art,
yes, the RowSource of a combobox or listbox can be created with code.
The first step would be to make a query that shows the data you want. Then copy its SQL and modify (or create) the WHERE clause with VBA and make that the RowSource.
How will this be triggered?
have an awesome day,
crystal
On 9/16/17 1:47 PM, dbalorenzini@yahoo.com [MS_Access_Professionals] wrote:
Can you create and populate a listbox control dynamically using vba?
Thank you,
Art Lorenzini
SD
Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (10) |
Tidak ada komentar:
Posting Komentar