|
 |
access thread: List Box problems(Access 2002)
Message #1 by "KennethMungwira" <KennethMungwira@y...> on Tue, 25 Feb 2003 22:30:42
|
|
The changes you requested to the table were not successful because they
would create duplicate values in the index, primary key, or relationship.
(Error 3022)
Problems with list box, which has a query running behind it. the first
time I use the mouse roller, the items in the listbox are fine, but if I
use it a second time after doing another search the above error message
occurs.
Here is the find button code.
Private Sub CmdFind_Click()
Dim strSQL As String
Dim strName As String ' Transformer Name
Dim strZone As String ' Transformer Zone
lstSource.Selected(lstSource.ListIndex) = 0
strSQL = "SELECT DISTINCTROW [ID],[Bus1],[Bus2],[Ckt],[Name],[PFCode],
[InYr],[InSea],[OutYr],[OutSea],[SumRateA1],[Zone] FROM
[XfmrData_InYrGEO3LEO8]"
If IsNull([Forms]![NewXfrmr]![txtTZone]) Then
strZone = ""
Else
strZone = [Forms]![NewXfrmr]![txtTZone]
End If
If IsNull([Forms]![NewXfrmr]![txtTName]) Then
strName = ""
Else
strName = [Forms]![NewXfrmr]![txtTName]
End If
strSQL = strSQL & "WHERE"
'Me.lstSource.Requery
If strZone <> "" And strName <> "" Then ' If neither bus To / From is
blank SELECT using both
strSQL = strSQL & "[Name] Like'*" & strName & "*'And [Zone]=" &
strZone
ElseIf strName <> "" And strZone = "" Then
strSQL = strSQL & "[Name] LIKE'*" & strName & "*'"
Else
strSQL = strSQL & "[Zone]=" & strZone
End If
strSQL = strSQL & ";"
'MsgBox "Before"
[Forms]![NewXfrmr]![lstSource].RowSource = strSQL
[Forms]![NewXfrmr]![txtTName].SetFocus
'MsgBox "New"
End Sub
Please help, I think I need to clear the listbox, after each find
function.
Message #2 by "KennethMungwira" <KennethMungwira@y...> on Wed, 26 Feb 2003 00:42:45
|
|
Dear Sir or madam,
I can not figure out why this list box (unbounded), keeps on doing this
when I use the scroller on my mouse more than twice.
Please help
or direct me to some code that might help....
Message #3 by "KennethMungwira" <KennethMungwira@y...> on Wed, 26 Feb 2003 23:11:16
|
|
Dear Sir or Madm,
can anyone let me know what I am doing wrong, with this code, when I
find the string, it seems to place the answer ontop of the original
answer, making duplicates. Thus I have to clear out the list box. How do
I do this????????????????????
Thank you
|
|
 |