I am importing Word fields into various Access tables. The database is normalized with referential integrity turned on. However, when I run the code to populate the tables, it is done one table at a time. So if I have a one-to-one relationship with referential integrity turned on, it won't let me save the first table without a record in the second table. Following is a sample of the code:
Sub ProjectLocation()
'Update tblProjectLocation
rst.Open "tblProjectLocation", cnn, _
adOpenKeyset, adLockOptimistic
With rst
.AddNew
![strSystemWarrantyRegistration#] = doc.FormFields ("fldWarrantyRegis").Result
!strPName = doc.FormFields("fldProjectName").Result
!strPStreet = doc.FormFields("fldProjectAddress").Result
!strPCity = doc.FormFields("fldProjectCity").Result
!strPState = doc.FormFields("fldProjectState").Result
!strPZip = doc.FormFields("fldProjectPostalCode").Result
.Update
.Close
End With
End Sub
Sub InternalMeasure()
rst.Open "tblInternalMeasure", cnn, _
adOpenKeyset, adLockOptimistic
With rst
.AddNew
![strSystemWarrantyRegistration#] = doc.FormFields("fldWarrantyRegis").Result
.Update
.Close
End With
End Sub
strSystemWarrantyRegistration# is the key field. It works just fine when I turn referential integrity off. Any suggestions?
Sub ProjectLocation()
'Update tblProjectLocation
rst.Open "tblProjectLocation", cnn, _
adOpenKeyset, adLockOptimistic
With rst
.AddNew
![strSystemWarrantyRegistration#] = doc.FormFields ("fldWarrantyRegis").Result
!strPName = doc.FormFields("fldProjectName").Result
!strPStreet = doc.FormFields("fldProjectAddress").Result
!strPCity = doc.FormFields("fldProjectCity").Result
!strPState = doc.FormFields("fldProjectState").Result
!strPZip = doc.FormFields("fldProjectPostalCode").Result
.Update
.Close
End With
End Sub
Sub InternalMeasure()
rst.Open "tblInternalMeasure", cnn, _
adOpenKeyset, adLockOptimistic
With rst
.AddNew
![strSystemWarrantyRegistration#] = doc.FormFields("fldWarrantyRegis").Result
.Update
.Close
End With
End Sub
strSystemWarrantyRegistration# is the key field. It works just fine when I turn referential integrity off. Any suggestions?