|
-
Jul 2nd, 2001, 09:32 AM
#1
Thread Starter
Addicted Member
Datagrid buttonclick event
I am using the datagrid to show some information about a person, but I have a password field that can not be shown in the datagrid for security reasons. I need to enable it so that when the user clicks on the row of the person whose password they need to verify, it will pop up in a seperate textbox. I am pretty sure that this would need to be done in the buttonclick event. This would be the query that I need to use to find the correct password:
"SELECT * FROM AuthorizationInformation " & _
"WHERE lastname = ****COL1CURRENTROW " & _
"AND firstname = ****COL0CURRENTROW " & _
"AND companyname = ****COL2CURRENTROW' ;", cnn,adOpenKeyset, adLockOptimistic
I don't know how to select the cells in the current row, to do a query on it. Anybody know how to do this?
Normal is boring...
 smh 
-
Jul 2nd, 2001, 10:21 PM
#2
PowerPoster
smh here ya are:
1) Add a combo box to your form. And fill it with all your details you want! This is relative to the colum it's going to appear in!
2) Here's some code! Try this change relative names though!
Like combo1, datagrid name, field name etc.
Private Sub Form_Load()
'dbg is the name of the dbgrid.
dbg.Columns("InsertNameHere").Button = True
End Sub
Private Sub dbg_ButtonClick(ByVal ColIndex As Integer)
If ColIndex = 1 Then ' refering to 2nd column. 1st colmn is 0
Combo1.Top = dbg.Top + dbg.RowTop(dbg.Row) + dbg.RowHeight
Combo1.Left = dbg.Left + dbg.Columns(ColIndex).Left
' Width and Height properties can be set a design time
' The width of the list does not have to be the same as the width of the grid column
Combo1.Width = dbg.Columns("InsertNameHere").Width 'again companyname is field name
Combo1.Visible = Not Combo1.Visible
If Combo1.Visible Then
Combo1.Text = dbg.Text
Combo1.ZOrder ' make sure the list is on top of the grid
End If
End If
End Sub
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
|