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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSTAB. Double click in list view - pass info to next tab

Status
Not open for further replies.

SwanSong4

MIS
Jul 19, 2001
9
US
I am using SSTab, I am trying to set it up where you enter a name, then click a command button (find) and it will show a list box with First name, last name, and a number. When you double click on the number, I want the TAB to pull the info thats related to the number (in database) and send that to the next Tab, filling in the text boxes.






 
ummm... I'm not sure what specifically you want to know how to do. But, to force the tab change, use
Code:
SSTab1.Tab = 1
and to do read from the listbox, (as long as it's on the same form), Use .Itemdata property to store and read an invisible piece of data. To determine if someone has changed tabs, use the the click event of the SSTab.

Kevin
 
Thanks, I guess I was really looking for SSTab1.tab = 1.
My next concern is trying to double click in the list view box and carry the information to the next tab. From the first screen, its just 2 text boxes, and a find command button, when you enter a name or letter and click find, the listview box below shows , first name, last name, and quote number.
If needed, I can supply the code I have so far.
 
Yeah, I think that would help. If you can post it here because it's small enough, do that, otherwise zip it up and send it to me at Kevin_G_Mossey@Fleet.com, do not send it as an .EXE, or .bas or .mdb, or .frm or .vbp... I will not get it.
 
General D.

Public cnPAIC As New ADODB.Connection
Public rsAppMaster As New ADODB.Recordset

Private Sub Form_Load()
With LvwList1
.ColumnHeaders.Add , "Quote", "Quote Number"
.ColumnHeaders.Add , "LName", "Last Name"
.ColumnHeaders.Add , "Fname", "First Name"

.ColumnHeaders("LName").Width = (.Width * 0.985) * 0.4
.ColumnHeaders("Fname").Width = (.Width * 0.985) * 0.4
.ColumnHeaders("Quote").Width = (.Width * 0.985) * 0.3
.View = lvwReport
.Sorted = True
.FullRowSelect = True
End With

With cnPAIC
.ConnectionString = "FILEDSN=PAIC_FileDSN;"
.Open
.CursorLocation = adUseClient
End With

Private Sub CmdFind_Click()
With LvwList1
.ListItems.Clear
.Refresh
End With

Dim intNoMatch As Integer
Loadlistview
end sub

Private Sub Loadlistview()
Dim strSearch As String
Dim ItmDriver As ListItem
Dim k As Integer

If rsAppMaster.State = adStateOpen Then
rsAppMaster.Close
End If

strSearch = "Select AMLNM as " & Chr(34) & "Last Name" & Chr(34) & ", AMFNM as " & Chr(34) & "First Name" & Chr(34) & " , AMQTE as " & Chr(34) & "Quote Number" & Chr(34) & _
"from ApplicationMaster where AMLNM = " & Chr(39) & TxtLname.Text & Chr(39) & " or AMLNM LIKE " & Chr(39) & TxtLname.Text & "%" & Chr(39) & " ORDER by AMLNM, AMFNM"

rsAppMaster.Open strSearch, cnPAIC, adOpenDynamic, adLockReadOnly
While Not rsAppMaster.EOF
For k = 1 To 30
If rsAppMaster.EOF = True Then Exit Sub
Set ItmDriver = LvwList1.ListItems.Add(, rsAppMaster.Fields(2).Value & "-" & rsAppMaster.Fields(0).Value, rsAppMaster.Fields(2).Value)
ItmDriver.SubItems(1) = rsAppMaster.Fields(0).Value
ItmDriver.SubItems(2) = rsAppMaster.Fields(1).Value
rsAppMaster.MoveNext
Next
Wend

End Sub
 
First thing to do is fix this:
strSearch = Whatever unreadable sql statement that was

to:
Code:
strSearch = "Select TOP 30 AMLNM as [Last Name], AMFNM as [First Name], AMQTE as [quote=Number] from ApplicationMaster where AMLNM='" & Replace(TxtLname,"'","''") & "' or AMLNM LIKE '" & Replace(TxtLname,"'","''") & "%' ORDER by AMLNM, AMFNM"

and drop the For...Next loop.

Then since you are using a listview control, not a listbox control (two completely different controls) - use:
Code:
Private Sub lvwList1_DblClick()
  With lvwList1.SelectedItem 
    MsgBox .Text & vbCr & _
           .SubItems(1) & vbCr & _
           .SubItems(2)
  End With
End Sub

or the key for a listitem in something other than a msgbox to re-execute a query, and populate the text boxes.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top