I've looked many places without an answer but I am having an issue with clicking my record selector in my datasheet subform and it doesn't fire on the first click but does every time after. I am using the Current event. I have 3 buttons: ADD, EDIT, DELETE. I have no issues with ADD because I'm not using the Current event for it. If I click either EDIT or DELETE button, a text box pops up above my datasheet. I don't allow the user to edit in the datasheet itself. Instead I want them to select a record where the record field (i.e. cell) value is populated in the textbox where they can then edit or choose to delete the value from the database. It works with the exception of the first click on the datasheet record not working, but does there after.
A brief explanation of the code I believe where the problem lies. I can post more if needed but maybe someone knows right of hand what the issue is.
I click either EDIT or DELETE button. Textbox pops up over datasheet where as the user clicks a record, a specific chosen field value in that record shows up in the textbox. First click, nothing happens. Textbox is empty. 2nd click and after the correct value is shown in the textbox. If user wants to edit a value, he does so in the textbox and clicks save where it is updated in the table. If wants to delete value, clicks confirm delete with warning message. So on and so forth where value is deleted from table. I have no issues with updating, deleting, or adding values to the table, it's just that pesky first click that does nothing that is bothering me.
Current Event code within my subform:
'************************************************* *******************************
' This sub is part of my datasheet subform.
Private Sub Form_Current()
If Sel_Btn = "edit" Or Sel_Btn = "delete" Then
Dim tmp_area_sel As String
If Not (Me.Form.Recordset.EOF And Me.Form.Recordset.BOF) Then
With Me.Form.Recordset
Me.tmp_area_txtbx = .Fields("Area")
End With
End If
tmp_area_sel = Me.tmp_area_txtbx
' Sends the selected value, captured in hidden textbox within my subform footer,
' to my parent form where the value is shown in my textbox
Call Me.Parent.Send_Selection(tmp_area_sel)
End If
End Sub
'************************************************* *******************************
Thanks in advance everyone!!