Results 1 to 7 of 7
Thread Tools
- Show Printable Version
Forbes
- View Profile
- View Forum Posts
Competent Performer
- Windows 10 Access 2016
- Join Date
- Mar 2017
- Posts
- 133
How can I print the results from this 4 into a text box
Code:
Sub ShowUserRosterMultipleUsers() Dim cn As Object ' ADODB.ConnectionDim rs As Object ' ADODB.Recordset Const adSchemaProviderSpecific As Long = -1 Set cn = CreateObject("ADODB.Connection") cn.Provider = "Microsoft.ACE.OLEDB.12.0" cn.Open "Data Source=C:\Users\admin\Desktop\Reports.accdb" Set rs = cn.OpenSchema(adSchemaProviderSpecific, _ , "{947bb102-5d43-11d1-bdbf-00c04fb92675}") ' Output the list of all users in the current database. Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _ "", rs.Fields(2).Name, rs.Fields(3).Name Do While Not rs.EOF Debug.Print rs.Fields(0), rs.Fields(1), _ rs.Fields(2), rs.Fields(3) rs.MoveNext Loop End Sub
Last edited by Forbes; 04-18-2017 at 07:54 PM.
Reply With Quote
June7
- View Profile
- View Forum Posts
VIP
- Windows 7 64bit Access 2010 32bit
- Join Date
- May 2011
- Location
- The Great Land
- Posts
- 53,156
Maybe like:
Code:
Do While Not rs.EOF Me.tbxNames = Me.tbxNames & rs.Fields(0) & ", " & rs.Fields(1) & ", " & rs.Fields(2) & ", " & rs.Fields(3) & vbCrLf rs.MoveNextLoop
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Reply With Quote
Forbes
- View Profile
- View Forum Posts
Competent Performer
- Windows 10 Access 2016
- Join Date
- Mar 2017
- Posts
- 133
Pretty nifty, although the only field that shows is the Computer Name Header and I get a debug error of Object required. pointing to your line?
Reply With Quote
Micron
- View Profile
- View Forum Posts
Very Inert Person
- Windows 7 32bit Access 2007
- Join Date
- Jun 2014
- Location
- Ontario, Canada
- Posts
- 13,089
Likely you copied the example verbatim and don't have a control called tbxNames?
You should post what you tried or else we're just guessing.Reply With Quote
Forbes
- View Profile
- View Forum Posts
Competent Performer
- Windows 10 Access 2016
- Join Date
- Mar 2017
- Posts
- 133
Code:
Sub ShowUserRosterMultipleUsers() Dim cn As Object ' ADODB.ConnectionDim rs As Object ' ADODB.Recordset Const adSchemaProviderSpecific As Long = -1 Set cn = CreateObject("ADODB.Connection") cn.Provider = "Microsoft.ACE.OLEDB.12.0" cn.Open "Data Source=C:\Users\admin\Desktop\Reports.accdb" Set rs = cn.OpenSchema(adSchemaProviderSpecific, _ , "{947bb102-5d43-11d1-bdbf-00c04fb92675}") ' Output the list of all users in the current database. Forms!frmadmin!txtuserslive = rs.Fields(0).Name frmadmin.txtuserslive = frmadmin.txtuserslive & rs.Fields(0).Name & ", " & rs.Fields(1).Name & ", " & rs.Fields(2).Name & ", " & rs.Fields(3).Name & vbCrLf Do While Not rs.EOFfrmadmin.txtuserslive = frmadmin.txtuserslive & rs.Fields(0) & ", " & rs.Fields(1) & ", " & rs.Fields(2) & ", " & rs.Fields(3) & vbCrLf rs.MoveNext Loop End Sub
Reply With Quote
June7
- View Profile
- View Forum Posts
VIP
- Windows 7 64bit Access 2010 32bit
- Join Date
- May 2011
- Location
- The Great Land
- Posts
- 53,156
Maybe prefix with the Forms collection qualifier.
Forms!frmadmin.txtuserslive = Forms!frmadmin.txtuserslive ...
or if the code is behind the form, use the Me alias as in my example
or could use a string variable in place of the textbox in the loop and then outside the loop set the textbox to the variable. See if that makes a difference. If same error then the issue is with the recordset object.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Reply With Quote
Forbes
- View Profile
- View Forum Posts
Competent Performer
- Windows 10 Access 2016
- Join Date
- Mar 2017
- Posts
- 133
Hey June7,
Thank you for your input, using the "Forms!" Prefix ended up displaying the desired result. I have the call attached to a command button and when I run it I now see the information I want however the computer name shows but the login name and connected state will not show until I click inside the text box which is weird? But thank you so much!
Reply With Quote
«Previous Thread|Next Thread»
Similar Threads
-
Email picture not showing for remote users
By trevor40 in forum Programming
Replies: 2
Last Post: 08-12-2016, 01:02 AM
-
Building a database a table thats showing active records day by day.
By medusa3604 in forum Database Design
Replies: 2
Last Post: 11-12-2015, 02:36 AM
-
Visio Viewer Active X control not showing drawing in report
By Rumpelstiltskin in forum Reports
Replies: 12
Last Post: 10-01-2014, 08:17 PM
-
List of all users from active directory
By bignate in forum Programming
Replies: 3
Last Post: 10-11-2013, 05:53 AM
-
By royarellano in forum Access
Replies: 0
Last Post: 12-08-2011, 02:32 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
- BB code is On
- Smilies are On
- [IMG] code is On
- [VIDEO] code is On
- HTML code is Off
Forum Rules
Other Forums: Microsoft Office Forums
- Contact Us
- Microsoft Access Forums
- Privacy Statement
- Top
All times are GMT -6. The time now is 07:14 AM.
Powered by vBulletin® Version 4.2.5
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.
AccessForums.net is not affiliated with Microsoft