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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another Update Query VB Code Question

Status
Not open for further replies.

hext2003

Technical User
Oct 9, 2006
119
US
OK, I got my other queries to work (thanks from help here!)

I now have to do another update query but this time the Primary key is two fields in both TableA and TableB

How do you code that?

This is what I have

Dim SQL1 As String

SQL1 = "Update A_Addr" & " RIGHT JOIN csm_addr " & _
"ON Ar_Addr.Key = csm_addr.addr_prop " & _
"SET Ar_Addr.Key = [csm_addr].[addr_prop]," & _
"Ar_Addr.Num1 = [csm_addr].[addr_stnumf]," & _
"Ar_Addr.Num2 = [csm_addr].[addr_stnumt]," & _
"Ar_Addr.dir = [csm_addr].[addr_stdir]," & _
"Ar_Addr.street = [csm_addr].[addr_stname]," & _
"Ar_Addr.unit = [csm_addr].[addr_stunit]," & _
"Ar_Addr.city = [csm_addr].[addr_city]," & _
"Ar_Addr.zip = [csm_addr].[addr_zip]"

DoCmd.RunSQL SQL1

This worked when I had just one Primary Key
now TableA needs fields 1 and 2 to create a primary/composite key

and I want to match that on TableB field 1 and 2

Any Advice??

TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top