I have SQL database with the following tables. The table structure is condensed for this question.
tbl.Vendor
VendorId (guid)
AccountNumber
Note
tbl.VendorAlert
AlertId (guid)
VendorId (guid)
AlertMsg
tbl.VendorAlert has its uniqued Id (AlertId), but also contains unique id VendorID which links the record to tbl.Vendor.
The existing SQL tables tbl.Vendor and tbl.VendorAlert are linked tables within Access.
Access data entry will NOT be ADDING vendor records, only editing the value of the Note column for existing SQL tbl.Vendor rows. As such, I have been able to create a simple EventProcedure as follows to set the value for tbl.Vendor.Note:
Private Sub btnCommand16_Click()
Me.[Note] = "ADBPT"
Me.Refresh
End Sub
The problem I have is when I also need to add a NEW record into the tbl.VendorAlert. I thought of creating a pass-through query as follows:
INSERT INTO VendorAlert (AlertId, VendorId, AlertMsg)
VALUES (NewID(), 'guid ref problem', 'alert message text')
How do I specify the guid value for 'guid ref problem? The code needs to pull the existing VendorId guid from the Vendor table (ie the same "Me" value as referenced in the prior code.
Any help will be greatly appreciated.