J
jas580
Hello, I posted the following last month and never got any responses so I'm
re-posting. Thanks for the help...
I have the following:
List Box: [Accounts]; fields [Acct#],[AcctName] from query
List Box: [Current Accounts]; fields [Acct#] from [Add_Button]
Cmd Button: [Add_Button]; adds the stored field [Acct#] from [Accounts] to
[Current Accounts]
I would like both list boxes to look the same so I need [Current Accounts]
to show [AcctName].
The code I've been using on the add button is as follows (thanks to the
community- works great!):
-------------------------------------------------------------------
Private Sub Add_Button_Click()
Dim VaxListCounter As Integer, VaxCurrentCounter As Integer
Dim VaxListItems As Integer, VaxCurrentItems As Integer
Dim ListStr As String, FoundInList As Integer
VaxListItems = [Accounts].ListCount - 1
VaxCurrentItems = [Current Accounts].ListCount - 1
For VaxListCounter = 0 To VaxListItems
If [Accounts].Selected(VaxListCounter) = True Then
If IsNull([Current Accounts].RowSource) Then
ListStr = [Accounts].Column(0, VaxListCounter) & ";"
[Current Accounts].RowSource = ListStr
Else
FoundInList = False
For VaxCurrentCounter = 0 To VaxCurrentItems
If [Current Accounts].Column(0, VaxCurrentCounter) =
[Accounts].Column(0, VaxListCounter) Then
FoundInList = True
End If
Next VaxCurrentCounter
If Not FoundInList Then
ListStr = [Current Accounts].RowSource &
[Accounts].Column(0, VaxListCounter) & ";"
[Current Accounts].RowSource = ""
[Current Accounts].RowSource = ListStr
End If
End If
End If
Next VaxListCounter
End Sub
re-posting. Thanks for the help...
I have the following:
List Box: [Accounts]; fields [Acct#],[AcctName] from query
List Box: [Current Accounts]; fields [Acct#] from [Add_Button]
Cmd Button: [Add_Button]; adds the stored field [Acct#] from [Accounts] to
[Current Accounts]
I would like both list boxes to look the same so I need [Current Accounts]
to show [AcctName].
The code I've been using on the add button is as follows (thanks to the
community- works great!):
-------------------------------------------------------------------
Private Sub Add_Button_Click()
Dim VaxListCounter As Integer, VaxCurrentCounter As Integer
Dim VaxListItems As Integer, VaxCurrentItems As Integer
Dim ListStr As String, FoundInList As Integer
VaxListItems = [Accounts].ListCount - 1
VaxCurrentItems = [Current Accounts].ListCount - 1
For VaxListCounter = 0 To VaxListItems
If [Accounts].Selected(VaxListCounter) = True Then
If IsNull([Current Accounts].RowSource) Then
ListStr = [Accounts].Column(0, VaxListCounter) & ";"
[Current Accounts].RowSource = ListStr
Else
FoundInList = False
For VaxCurrentCounter = 0 To VaxCurrentItems
If [Current Accounts].Column(0, VaxCurrentCounter) =
[Accounts].Column(0, VaxListCounter) Then
FoundInList = True
End If
Next VaxCurrentCounter
If Not FoundInList Then
ListStr = [Current Accounts].RowSource &
[Accounts].Column(0, VaxListCounter) & ";"
[Current Accounts].RowSource = ""
[Current Accounts].RowSource = ListStr
End If
End If
End If
Next VaxListCounter
End Sub