hello
I have an form with one listbox, 2 textboxes and 3 command bottons (new, edit, delete):
when you navigate in list box, the textboxes are not enable. Wen I push command button "New" the text boxes will be enabled and if are data inside of textboxes an new record in table will be add.
Edit button will edit the fields (enable textboxes) and rewrite the fields with condition that can not be null the input from textboxes.
I like to add on the new button an cod that will focus on textbox[nume] and stay there till something will be write.
On textbox I have already an beforeUpdate events but it is working for for edit button:
How can I putted to act the same on New button event?
Wen I push new button I can navigate from one textbox to another if are empty
Code:
Private Sub nume_BeforeUpdate(Cancel As Integer)
If IsNull(Len(Me.nume)) Then Cancel = True
End Sub
Private Sub Command38_Click()
On Error GoTo Err_Command38_Click
Me.nume = nume
Me.nume.SpecialEffect = 0
Me.nume.BackStyle = 1
Me.nume.BorderStyle = 1
Me.nume.Locked = False
Me.prenume = prenume
Me.prenume.SpecialEffect = 0
Me.prenume.BackStyle = 1
Me.prenume.BorderStyle = 1
Me.prenume.Locked = False
If IsNull(Me.nume) And IsNull(Me.prenume) Then
Exit Sub
Else
DoCmd.GoToRecord , , acNewRec
Me!nume.SetFocus
Me!nume.SelLength = 0
End If
Exit_Command38_Click:
Exit Sub
Err_Command38_Click:
MsgBox Err.Description
Resume Exit_Command38_Click