SBBmaster09
Registered User.
- Local time
- Today, 18:22
- Joined
- Apr 26, 2013
- Messages
- 92
I have this Update Entry Form.. I have so many fields here but the logic thing to do was, when I open the Update Form, the textfields will display all the data that it can get from the table I've made. Then I can edit those fields and when I press SAVE button, a prompt will show if the data will be saved yes or no? If yes, all fields that has been changed will be saved, and if the field is not changed, it will just save its old data[meaning it will not be lost]. All changes made in the text field will be saved in the table.
Nameof Form: UpdateForm
Table Name: tbl_Roster
Sample TextFields: FieldNameInTheTable[textfieldnameinform]
*Last Name[txtLName], First Name[txtFName]
I use an [EnterpriseID] to locate which data will be updated. Can someone help me with the codes in SAVE button or in Form_Load()
I am also using db As DAO.Database, rst As DAO.Recordset, strSQL As String
I am currently using this codes but doesnt works for me. Help me for easier use or any problem with my coding. Thanks.
SAVE BUTTON
FORM LOAD
Thanks for the help.
Nameof Form: UpdateForm
Table Name: tbl_Roster
Sample TextFields: FieldNameInTheTable[textfieldnameinform]
*Last Name[txtLName], First Name[txtFName]
I use an [EnterpriseID] to locate which data will be updated. Can someone help me with the codes in SAVE button or in Form_Load()
I am also using db As DAO.Database, rst As DAO.Recordset, strSQL As String
I am currently using this codes but doesnt works for me. Help me for easier use or any problem with my coding. Thanks.
SAVE BUTTON
Code:
Private Sub btnSaveEntry_Click()
Set db = CurrentDb
Set rst = db.OpenRecordset("tbl_Roster", dbOpenDynaset)
rst.Edit
rst("Last Name").Value = txtLName.Value
rst("First Name").Value = txtFName.Value
rst.Update
rst.Close
db.Close
MsgBox "Your Account has been Updated", vbInformation, "Success"
'DoCmd.Close acForm, Me.Name
End Sub
FORM LOAD
Code:
Private Sub Form_Load() txtEID.Value = DLookup("[Enterprise ID]", "tbl_Roster", "[Enterprise ID]='" & strUsername & "'")
Me.txtLName.Value = DLookup("[Last Name]", "tbl_Roster", "[Enterprise ID]='" & strUsername & "'")
Me.txtFName.Value = DLookup("[First Name]", "tbl_Roster", "[Enterprise ID]='" & strUsername & "'")
End Sub
Thanks for the help.
