Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning user/computer names in a messagebox

Status
Not open for further replies.

Porsche996GT2

Programmer
Oct 13, 2004
41
US
Hello all,

I'm trying to return user/computer names in a messagebox using the Openschema method. Unfortunately, when I try to make them pop up in a msgbox, I can only make 1 of them appear. How do I make all of the computernames from the recordsets come out in 1 messagebox. TIA!
 
If you have the information in a public recordset available to the msgbox then the GetString should work. This returns the recordset as a formatted string.

Me.yourmsgbox = rs.GetString
 
Hi cmmrfrds,

Thanks for your reply. I am actually doing a loop on the recordset with MOVENEXT to extract each record. Eventually, I will use the values to do a DLOOKUP on a table with the computer names and people's real names, so that when I press the button for this subroutine, it returns the real names of the users. Is this at all possible to do?
 
Do you want to put the names in a Listbox which can hold multiple records and then select them individually from the list?
I believe an AddItem was added to Access after version 2000, but I am not sure. This would be the simplest way to go if you have a later version of Access.
 
Hello cmmrfrds,

I apologize for the late reply. The names need not be selected; I just need to see all the names in the messagebox. I've figured out the initial issues I have; I just need to know how to concatenate values inside a loop. Care to help me out with that?

Thanks,

PorscheGT2
 
Does this help?

Dim strToDisplay as String

strToDisplay = vbNullString

Start Loop
strToDisplay = strToDisplay & vbcrlf & NewValue
End Loop
 
Thanks FancyPrairie,

I actually used this instead and works perfectly:

Dim buffer

...
...

'After my parse loop:

If IsNull(pname = DLookup("[Name]", "Pricing Name List Table", "[Computer Name] = '" & cname & "'")) Then
pname = "Unknown"
Else: pname = DLookup("[Name]", "Pricing Name List Table", "[Computer Name] = '" & cname & "'")
End If
fname = cname & " - " & pname & Chr(13)
buffer = buffer + fname
rst.MoveNext

Sorry for the clunky code ;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top