Hi people
Another, probably quite trivial question, I'm afraid! I have a Main Form - "Customers" - which has an Add button on. When you click this another Form is called. This is the data-entry form. I am trying to work it so that once I OK the data-entry form, the record details that I have just entered is the one displayed in the main Form. I'm sure its somewhere along the lines of LastModified but I just cant seem to get it to work. This is the code that I've used so far:
Private Sub cmdUpdate_Click()
If MsgBox("Are you sure you want to add the record?", 4, "Update?"
= 6 Then
Set dbs = CurrentDb
Set MyRS = dbs.OpenRecordset("Customers", dbOpenDynaset)
With MyRS
.AddNew
If Len(Trim(Text0)) > 0 Then
![Title] = UCase(Mid(Text0, 1, 1)) & Mid(Text0, 2)
End If
If Len(Trim(Text2)) > 0 Then
![Forename] = UCase(Mid(Text2, 1, 1)) & Mid(Text2,2)
End If
![TelWork] = [Text20]
![TelFax] = [Text22]
![TelMobile] = [Text24]
! = [Text26]
.Update
MyRS.Bookmark = MyRS.LastModified
Forms![customers].Bookmark = MyRS.Bookmark
End With
MsgBox "Record has been added!"
Me![Text0] = ""
Me![Text2] = ""
Me![Text20] = ""
Me![Text22] = ""
Me![Text24] = ""
Me![Text26] = ""
Me![Text0].SetFocus
dbs.Close
Else
Me![Text0].SetFocus
Exit Sub
End If
End Sub
Any help would be much appreciated....
Another, probably quite trivial question, I'm afraid! I have a Main Form - "Customers" - which has an Add button on. When you click this another Form is called. This is the data-entry form. I am trying to work it so that once I OK the data-entry form, the record details that I have just entered is the one displayed in the main Form. I'm sure its somewhere along the lines of LastModified but I just cant seem to get it to work. This is the code that I've used so far:
Private Sub cmdUpdate_Click()
If MsgBox("Are you sure you want to add the record?", 4, "Update?"
Set dbs = CurrentDb
Set MyRS = dbs.OpenRecordset("Customers", dbOpenDynaset)
With MyRS
.AddNew
If Len(Trim(Text0)) > 0 Then
![Title] = UCase(Mid(Text0, 1, 1)) & Mid(Text0, 2)
End If
If Len(Trim(Text2)) > 0 Then
![Forename] = UCase(Mid(Text2, 1, 1)) & Mid(Text2,2)
End If
![TelWork] = [Text20]
![TelFax] = [Text22]
![TelMobile] = [Text24]
! = [Text26]
.Update
MyRS.Bookmark = MyRS.LastModified
Forms![customers].Bookmark = MyRS.Bookmark
End With
MsgBox "Record has been added!"
Me![Text0] = ""
Me![Text2] = ""
Me![Text20] = ""
Me![Text22] = ""
Me![Text24] = ""
Me![Text26] = ""
Me![Text0].SetFocus
dbs.Close
Else
Me![Text0].SetFocus
Exit Sub
End If
End Sub
Any help would be much appreciated....