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

Urgent help needed with MS DB Grid in VB 6

Status
Not open for further replies.

css1015

Programmer
Oct 29, 2003
20
0
0
US
Hi,

I have a MS DB Grid control in VB 6 that is bound to a recordset with a static cursor and optimistic lock.

Step I) I am able to bind it and display the data fine. When I double-click on column 2 (colindex = 1) or column 3 (colindex = 2), I take the focus to a listbox populated in a different form 'frmListValueSelection' from which I ask the user to choose 1 value (see code below)

Private Sub DataGridPODetail_DblClick()
DataGridPODetail_HeadClick (DataGridPODetail.Col)
End Sub


Private Sub DataGridPODetail_HeadClick(ByVal ColIndex As Integer)

intSelectedIndex = ColIndex

Select Case intSelectedIndex
Case 1:
Me.Hide
blnTiresOrEquipmentRequested = True
blnUnitNumberRequested = False
frmListValueSelection.Caption = "Choose Item Category"
frmListValueSelection.Show
Case 2:
Me.Hide
blnUnitNumberRequested = True
blnTiresOrEquipmentRequested = False
frmListValueSelection.Caption = "Choose Unit Number / Truck Code"
frmListValueSelection.Show
End Select

End Sub

Private Sub DataGridPODetail_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer)
If IsNull(DataGridPODetail.Columns(ColIndex).Text) = False Then
DataGridPODetail.Columns(ColIndex).Text = Trim(DataGridPODetail.Columns(ColIndex).Text)
End If
End Sub


Once the value is chosen and the user clicks 'OK', the data grid in the original form 'frmPO' should update to show the value chosen from the listbox.

private sub frmListSelection.cmdOK_click

If blnTiresOrEquipmentRequested = True Then
rsPODetail.Fields("TiresOrEquipment").Value = Trim(lstFinal.List(0))
rsPODetail.Update
SendKeys "{TAB}"
frmPO.DataGridPODetail.Refresh
'frmPO.DataGridPODetail.SelText = frmPO.DataGridPODetail.Columns(1).Text
Else

If blnUnitNumberRequested = True Then
rsPODetail.Fields("UnitNumber").Value = Trim(lstFinal.List(0))
rsPODetail.Update
SendKeys "{TAB}"
frmPO.DataGridPODetail.Refresh
'frmPO.DataGridPODetail.SelText = frmPO.DataGridPODetail.Columns(2).Text
End If
End If

Unload Me
frmPO.Show

end sub

This code works when I run it inside my VB IDE, but when I compile it into an executable on the same machine as my VB IDE, and then try to perform the grid cell update by running the executable, the update does not happen right. Any clues, any reasons as to why this might be happening? Please feel free to correct any of the code above if necessary. Let me know, this is real urgent, I thought I had it all working but I have never seen a compiled executable work like this before. I have had problems while deploying it on a machine outside the IDE machine but not on the same machine.

Thanks a bunch in advance,

Chad
 
YOu say, "the update does not happen right". CLarify please. It doesn't happen right away? It doesn't happen at all? It saves errant data?

thnx.


ciao for niao!

AMACycle

American Motorcyclist Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top