Greetings from New Zealand
I have just followed GHudson method of copying a record by adding his code to the Onclick event of a command button on a data entry form and it works beautifully. As a newcomer to access this feature has had me stumped for a couple of weeks now. Thanks a lot GHUDSON
Code is:
Dim sFirstName As String
Dim sLastName As String
Dim sMailingLocation As String
Dim sPhoneNumber As String
sFirstName = FirstName 'FirstName is the name of the table field
sLastName = LastName
sMailingLocation = MailingLocation
sPhoneNumber = PhoneNumber
DoCmd.GoToRecord , , acNewRec
FirstName = sFirstName
LastName = sLastName
MailingLocation = sMailingLocation
PhoneNumber = sPhoneNumber
sFirstName = ""
sLastName = ""
sMailingLocation = ""
sPhoneNumber = ""
I am using this in a document database where some records may have many copies each of which must have it's own record but with a different copy number.
What I would really like to do now is to have an additional feature which when a copy of the record is made it will automatically increment the copy number field, (which I have set to default at 1,) dependent on the number of copies. That is add 1 to the current copy number field for each successive document record that is copied.
I have just followed GHudson method of copying a record by adding his code to the Onclick event of a command button on a data entry form and it works beautifully. As a newcomer to access this feature has had me stumped for a couple of weeks now. Thanks a lot GHUDSON
Code is:
Dim sFirstName As String
Dim sLastName As String
Dim sMailingLocation As String
Dim sPhoneNumber As String
sFirstName = FirstName 'FirstName is the name of the table field
sLastName = LastName
sMailingLocation = MailingLocation
sPhoneNumber = PhoneNumber
DoCmd.GoToRecord , , acNewRec
FirstName = sFirstName
LastName = sLastName
MailingLocation = sMailingLocation
PhoneNumber = sPhoneNumber
sFirstName = ""
sLastName = ""
sMailingLocation = ""
sPhoneNumber = ""
I am using this in a document database where some records may have many copies each of which must have it's own record but with a different copy number.
What I would really like to do now is to have an additional feature which when a copy of the record is made it will automatically increment the copy number field, (which I have set to default at 1,) dependent on the number of copies. That is add 1 to the current copy number field for each successive document record that is copied.