The Rev
Registered User.
- Local time
- Today, 13:31
- Joined
- Jan 15, 2003
- Messages
- 119
My database has gone through several iterations, as have we all, and I'd like to code a button that will browse for an older version of the DB and import some table data from the old into the new. I don't need every field, just some of the ones that users input data in. I know how to code the select file part, but working with the data from the older DB and importing it into my new DB's existing tables is where I am limited in my knowledge of VBA.
I can start simple. Here's my working code:
I basically need the data from the fields "Requirement_Validation" and "Requirement_Satisfied" in my Tbl_Requirements copied from the old version to the new version. Both have the identical Requirement_Number field and no new records are in either. How do I code opening the old DB's table and grabbing the data and then pasting it into the new one?
I can start simple. Here's my working code:
Code:
Const msoFileDialogFilePicker As Long = 3
Dim strSelectedFile As String
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
Set objSFolders = CreateObject("WScript.Shell").SpecialFolders
Path = objSFolders("MyDocuments")
With fdg
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "File Type", "*.accdb", 1
.InitialFileName = Path
If .Show = -1 Then
For Each strSelectedItem In .SelectedItems
'Code to work with data
Next strSelectedItem
End If
End With
I basically need the data from the fields "Requirement_Validation" and "Requirement_Satisfied" in my Tbl_Requirements copied from the old version to the new version. Both have the identical Requirement_Number field and no new records are in either. How do I code opening the old DB's table and grabbing the data and then pasting it into the new one?