Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Word Form Fields into Access Tables

Status
Not open for further replies.

dar149

MIS
Mar 5, 2002
117
US
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top