Hello there Good Day!
Anybody can help me or teach me the code on how to lock the text box on my program.
I have the navigation keys and add, edit, delete search command button. What i want is during the run time you cannot changed everything information in the text box without clicking the edit, delete, and add button. I have 10 text box object in my program with corresponding fields.
And this is the working code of my program...
Private Sub cmdadd_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub cmdclose_Click()
Dim h As String
h = MsgBox("Are you sure do you want to exit the program?", vbInformation + vbYesNo, "Exit")
If h = vbYes Then
End
End If
End Sub
Private Sub cmddel_Click()
Adodc1.Recordset.Delete
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
End If
End Sub
Private Sub cmdedit_Click()
Adodc1.Recordset.Update
End Sub
Private Sub cmdfirst_Click()
Adodc1.Recordset.MoveFirst
Text11.Text = DateDiff("YYYY", Text8.Text, Now)
End Sub
Private Sub cmdlast_Click()
Adodc1.Recordset.MoveLast
Text11.Text = DateDiff("YYYY", Text8.Text, Now)
End Sub
Private Sub cmdnxt_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
MsgBox "End of file!", vbInformation
End If
Text11.Text = DateDiff("YYYY", Text8.Text, Now)
End Sub
Private Sub cmdopen_Click()
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Label7.Visible = True
Label8.Visible = True
Label9.Visible = True
Label10.Visible = True
Text1.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Text5.Visible = True
Text6.Visible = True
Text7.Visible = True
Text8.Visible = True
Text9.Visible = True
Text10.Visible = True
Label13.Visible = True
Combo1.Visible = True
DataGrid1.Visible = True
Image1.Visible = True
Frame1.Visible = True
Label15.Visible = True
Text11.Visible = True
End Sub
Private Sub cmdprvs_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
MsgBox "Beginning of file!", vbInformation
End If
Text11.Text = DateDiff("YYYY", Text8.Text, Now)
End Sub
Private Sub cmdsearch_Click()
On Error Resume Next
If Combo1.ListIndex = -1 Then
MsgBox "No field selected", vbInformation
Exit Sub
End If
Dim dok As String
dok = InputBox("Enter " & Combo1 & " to search", "Searching")
Adodc1.Recordset.Close
Dim dwi As String
dwi = "Select * From warriorsinfo where " & Combo1.List(Combo1.ListIndex) & " = '" & dok & "'"
Adodc1.RecordSource = dwi
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox "No record found!", vbInformation
End If
Text11.Text = DateDiff("YYYY", Text8.Text, Now)
End Sub
Private Sub Form_Load()
Adodc1.CommandType = adCmdText
Text11.Text = DateDiff("YYYY", Text8.Text, Now)
End Sub