1. Copy Records Fn Part 1 (12:00)
Manually Copying a Record
The Broken Duplicate Record Macro
Correct Code to Duplicate Record
Issues with Append Queries
Review Developer 24 Code
Creating a function to copy records
Handling indexed fields, no duplicates
Avoiding manual duplication methods
Command button wizard bug
Using DoCmd.RunCommand for actions
Pausing in code using DoEvents
Clearing indexed field values
Running append queries manually
Issues with using a star in SQL
Dynamic code for copying with exclusions
Looping through table fields
Identifying auto numbers and primary keys
Altering indexes for the function
Preparation for writing the function
2. Copy Records Fn Part 2 (12:20)
Write the CopyRecord Sub
Loop thru Fields
Avoid Specified Primary Key
Copy Record Subroutine
Loop Through All Fields
Avoid Specified Primary Key
Specify Primary Key First
Create Global Function
Identify Current Record ID
Handle Multiple Record Sets
Use Field Count for Loop
Exclude Primary Key in Loop
Handle Potential Memory Leaks
Refresh Record Set After Copy
Requery to Maintain Position
Debugging Steps if Issues Occur
Test Code with Other Records
3. Copy Records Fn Part 3 (7:59)
Replace PrimaryKeyName with WhereCondition
No Need to Specify PK Name
Field.Attributes
dbAutoIncrField
Eliminate primary key requirement
Use WHERE condition for filtering
Check AutoIncrementField attribute
Use bitwise operations for attributes
Modify function for multiline parameters
Handle AutoNumber fields
Use Debug Compile for code verification
Resolve compact and repair issues
Detect indexed fields with no duplicates
4. Copy Records Fn Part 4 (16:10)
List Table Indexes
List Fields in Each Index
IsFieldUnique Function
Listing table indexes
Determining indexed fields
Checking if a field is unique
Writing helper functions
Using TableDef object
Looping through indexes
Identifying unique indexes
Listing fields in indexes
Handling composite indexes
Setting up unique constraints
Checking composite key uniqueness
Marking fields as indexed no duplicates
Creating IsFieldUnique function
Returning Boolean for field uniqueness
Error handling in functions
Optimizing function code
Using helper functions in CopyRecords
5. Copy Records Fn Part 5 (12:23)
Use IsFieldUnique in CopyRecords
Add Error Handling
Return ID of New Record
Integrating isFieldUnique function
Converting copy records subroutine to function
Implementing error handling in functions
Returning new record ID from function
Identifying primary key field in a recordset
Using dbAutoIncrField attribute for auto number
Handling unique fields during record copy
Initializing variables before copying records
Looping through fields to identify primary key
Skipping primary key during record copy
Capturing new ID for created record
Handling SQL Server auto number differences
Opening form to new record using ID
Displaying new record ID in status
Using DoCmd to open form with specific record