|
-
Oct 4th, 2000, 03:31 AM
#1
Thread Starter
Member
can someone suggest me how to put a look up. i have a look up command button and if i want to click it, i want to pop up a window that will display all the departments of the company.
thanks
-
Oct 4th, 2000, 06:02 AM
#2
_______
<?>
Code:
This should get you started:
1. Requirements 2nd form/listbox/command button
On form2 call the listbox lstDept, the command
button cmdReturn
2. A File as source of your departments (c:\departments.txt)
Assuming there are not a lot of departments and all you
want is departments I would use a text file.
'this is the code for Form1
Option Explicit
Private Sub cmdLookUp_Click()
Form1.Hide
Form2.Show
End Sub
'this is the code for Form2
Option Explicit
Private Sub cmdReturn_Click()
Form2.Hide
Form1.Show
End Sub
Private Sub Form_Load()
On Error GoTo quit:
Dim myFile As String, myVar As String
Dim intNum As Integer
myFile = "C:\departments.txt"
intNum = FreeFile
Open myFile For Input As intNum
While Not EOF(intNum)
Input #intNum, myVar
lstDept.AddItem myVar
Wend
Close #intNum
quit:
MsgBox "you need to write an error routine for the sub"
End Sub
Private Sub lstDept_Click()
MsgBox "You have selected " & lstDept.Text
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 4th, 2000, 08:16 AM
#3
In addition to what HeSaidJoe says, you can put the 2nd listbox on top of the current listbox and set the visible and forground properties to false.
You should be able to move the 2nd box around during runtime, such that the top edge of the box allows the selected item. You use the "Top" and "Left" properties for this.
Good Luck
DerFarm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|