Hi all. Been search a few days for a loop search through a table for displaying emails in a list format:
TABLE_A: with the following fields
NovellLoginName
EmailAddies
GroupA <- Either with a string "YES" or blank
GroupB <- Either with a string "YES" or blank
GroupC <- Either with a string "YES" or blank
FORM_A: with the following controls
ComboBox_GroupList <- Diplaying a selection for displaying GroupA, B, or C
* Using a test button to test things out for the time being
Button_TEST
VBA using so far:
Function TESTINGVBA()
Dim str_Emails as Long
Dim snp As DAO.Recordset
Set dbs = CurrentDb
Set snp = dbs.OpenRecordset("TABLE_A", dbOpenSnapshot)
'Creating a string of emails to display:
If ComboBox_GroupList = "GroupA" Then
snp.MoveFirst
Do Until snp.EOF
snp = DLookup("EmailAddies", "TABLE_A", "GroupA='YES'")
str_Emails = snp
snp.MoveNext
str_Emails = str_Emails & ", " & DLookup("EmailAddies", "TABLE_A", "GroupA='YES'")
Loop
End If
MsgBox snp 'Hopefully a string of emails will be displayed in a msgbox..but nope...
snp.Close
dbs.Close
End Function
Sorry about the miserable approach to the loop search and display method. Hope you can help. Thanks in advance.