I have a combo box that I am populating by a query. The problem is that when it reads the data from the database and it is seperated by a ",". like lastname, firstname it used the additem and adds the lastname and the first name as two seperate items. How can I get it to only add lastname, firstname exactly like that (i.e. smith, john) on the same row..
my code:
Dim db As Database
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
Dim strVAR As String
Dim stridowner As String
Dim X As Integer
If Me.cmbdatephase.Value = "January" Or Me.cmbdatephase.Value = "February" Or Me.cmbdatephase.Value = "March" Or Me.cmbdatephase.Value = "April" Or Me.cmbdatephase.Value = "May" Or Me.cmbdatephase.Value = "June" Or Me.cmbdatephase.Value = "July" Or Me.cmbdatephase.Value = "August" Or Me.cmbdatephase.Value = "September" Or Me.cmbdatephase.Value = "October" Or Me.cmbdatephase.Value = "November" Or Me.cmbdatephase.Value = "December" Then
Set cnn = CurrentProject.Connection
strSQL = "Select distinct txtidowner FROM NSAPLOG WHERE initialreviewphase='" & cmbdatephase.Value & "'"
Set rs = cnn.Execute(strSQL)
rs.MoveFirst
Do While Not rs.EOF
strVAR = rs.Fields(0).Value
rs.MoveNext
cmbowners.AddItem (strVAR)
Loop
rs.Close
Set rs = Nothing
Set cnn = Nothing
MsgBox "ID Owners retreived for reivew month: " & cmbdatephase.Value & ". Please select ID Owner from list and click send email reports button."
Else
MsgBox "Please select a Month to review."
End If
my code:
Dim db As Database
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
Dim strVAR As String
Dim stridowner As String
Dim X As Integer
If Me.cmbdatephase.Value = "January" Or Me.cmbdatephase.Value = "February" Or Me.cmbdatephase.Value = "March" Or Me.cmbdatephase.Value = "April" Or Me.cmbdatephase.Value = "May" Or Me.cmbdatephase.Value = "June" Or Me.cmbdatephase.Value = "July" Or Me.cmbdatephase.Value = "August" Or Me.cmbdatephase.Value = "September" Or Me.cmbdatephase.Value = "October" Or Me.cmbdatephase.Value = "November" Or Me.cmbdatephase.Value = "December" Then
Set cnn = CurrentProject.Connection
strSQL = "Select distinct txtidowner FROM NSAPLOG WHERE initialreviewphase='" & cmbdatephase.Value & "'"
Set rs = cnn.Execute(strSQL)
rs.MoveFirst
Do While Not rs.EOF
strVAR = rs.Fields(0).Value
rs.MoveNext
cmbowners.AddItem (strVAR)
Loop
rs.Close
Set rs = Nothing
Set cnn = Nothing
MsgBox "ID Owners retreived for reivew month: " & cmbdatephase.Value & ". Please select ID Owner from list and click send email reports button."
Else
MsgBox "Please select a Month to review."
End If