I don't even know what to call it.

01-13-2004, 06:21 AM
I'm writing a program that will allow employees to access client directories using client name or number in the custom app. I've got it working fine with client numbers but I don't even know where to begin if they enter in the client name. Currently, I'm using a datagrid that is populated by an access database. I can double click one of the client numbers in the datagrid and it will populate the directory and file list. How can I make this work:

When a user double clicks a client name how can I make the app look back at the table in access and populate the directory list and the file list correctly? In the table cltname comes after cltnum so does it have to read right to left? I'm not using adoc. Here is my code if it helps.

Thanks in advance.

Private Sub DataGrid1_Click()
Dim fldName As String
fldName = DataGrid1.SelText

dcmb_employee.Text = fldName
If Dir("H:\" & fldName, vbDirectory) <> "" Then
Dir1.Path = "h:\" & dcmb_employee.Text
MsgBox "Directory Doesn't Exist"
End If

End Sub

Private Sub dcmb_employee_KeyUp(KeyCode As Integer, Shift As Integer)
Dim txtLen As String
Dim mText As String
'Dim vBookMark As Long

With dcmb_employee
txtLen = Len(.Text)
Select Case KeyCode
Case vbKeyDelete 'trap these keys to not perform search
Case vbKeyBack
Case vbKeySpace
Case Else
Do While Not rstObj.EOF
If Option2(0) = True Then
'rstObj.Move vBookMark + 1, 1
If Trim(UCase(Left(rstObj!Cltname, txtLen))) = Trim(UCase(.Text)) And Trim(.Text) <> "" Then
.Text = rstObj!Cltname & " "
.SelStart = txtLen
.SelLength = Len(.Text) - Len(Trim(txtLen))
'vBookMark = rstObj.Bookmark
Exit Do
End If

If Trim(UCase(Left(rstObj!cltnum, txtLen))) = Trim(UCase(.Text)) And Trim(.Text) <> "" Then
.Text = rstObj!cltnum & " "
.SelStart = txtLen
.SelLength = Len(.Text) - Len(Trim(txtLen))
'vBookMark = rstObj.Bookmark
Exit Do
End If
End If
End Select
End With
'End If
End Sub

Private Sub cltView_Click()
fldName = dcmb_employee.Text
Dir1.Path = "h:\" & fldName
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Exit_Click()
End Sub

Private Sub File1_dblClick()
Dim ret As Long
StrExec = Dir1.Path & "\" & File1.FileName
ret = ShellExecute(GetDesktopWindow, vbNullString, StrExec, vbNullString, Dir1.Path, 5)
End Sub

Private Sub Form_Load()
Call OpenAccessDataBase
Call OpenAccessRecordSet("SELECT Cltnum, Cltname FROM Clients ORDER BY Cltnum")
Call FillDBGridWithData
End Sub
Sub FillDBGridWithData()
DataGrid1.Caption = cap5
DataGrid1.Columns.Add (0)
DataGrid1.DefColWidth = 2500
Set DataGrid1.DataSource = rstObj
End Sub

Private Sub opnFolder_Click()
Dim folderOpen
'Dim fldName As String
'fldName = dcmb_employee.Text
folderOpen = Shell("explorer.exe H:\" & fldName, vbNormalFocus)

End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum