Question : Enter data in a MSFlexgrid control

I am using a flexgrid control in MS Access 2000.  I have the columns and rows headers set up but I need to allow the user to enter data into the cells.  I have read that I need to position a text box on the cell that the user selects and capture what the user enters, but I do not know how to implement it.

Thank you for your help.

Answer : Enter data in a MSFlexgrid control

Ok, the code is for vb, zOrder is not available with vba. Pity that, its the 1st time Im looking at that link and it saves u having to do dblclick

Ok, What Ive done is used the click event instead
Flexgrid called MSFlexGrid1 and textbox called txtDataEntry

What u do is click on a cell, the textbox will appear, u need to enter text then press return key, clicking on the grid elsewhere wont work as its been disabled


Private Sub Form_Load()
    txtDataEntry.Visible = False
    MSFlexGrid1.Cols = 5
    MSFlexGrid1.Rows = 5
End Sub

Private Sub MSFlexGrid1_Click()
    txtDataEntry.Visible = True
    txtDataEntry.Move MSFlexGrid1.Left + MSFlexGrid1.CellLeft - 50, MSFlexGrid1.Top + MSFlexGrid1.CellTop - 50, MSFlexGrid1.CellWidth, MSFlexGrid1.CellHeight
    txtDataEntry.Value = MSFlexGrid1.Value
    txtDataEntry.SetFocus
    MSFlexGrid1.Enabled = False
End Sub

Private Sub txtDataEntry_AfterUpdate()
    On Error Resume Next
    MSFlexGrid1.Value = Nz(txtDataEntry.Value, "")
    MSFlexGrid1.Enabled = True
    MSFlexGrid1.SetFocus
    txtDataEntry.Visible = False
End Sub

Private Sub txtDataEntry_LostFocus()
    txtDataEntry_AfterUpdate
End Sub
Random Solutions  
 
programming4us programming4us