I'm using a form to determine if a record exist. If it doesn't then the program will open a form (TPAform) to add a record. If the record does exist, the program will open TPAFormUpdate (a form to update a record.)
Where should I put the following statement so that the information added or changed will be saved? rs.update
Private Sub TPACheck_Click()
Dim rs As Recordset
Dim db As Database
Dim strSQL3 As String
strSQL3 = "SELECT * FROM TPATable WHERE TPATable.ClientID = " & Me!UpdateTemp
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL3)
If rs.EOF And rs.BOF Then
DoCmd.Minimize
DoCmd.OpenForm "TPAForm"
rs.AddNew
[Forms]![TPAForm]![ClientID] = Me!UpdateTemp
Else
DoCmd.Minimize
DoCmd.OpenForm "TPAFormUpdate"
rs.Edit
End If
End Sub
Where should I put the following statement so that the information added or changed will be saved? rs.update
Private Sub TPACheck_Click()
Dim rs As Recordset
Dim db As Database
Dim strSQL3 As String
strSQL3 = "SELECT * FROM TPATable WHERE TPATable.ClientID = " & Me!UpdateTemp
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL3)
If rs.EOF And rs.BOF Then
DoCmd.Minimize
DoCmd.OpenForm "TPAForm"
rs.AddNew
[Forms]![TPAForm]![ClientID] = Me!UpdateTemp
Else
DoCmd.Minimize
DoCmd.OpenForm "TPAFormUpdate"
rs.Edit
End If
End Sub