Hi Guys,
I have a form in datasheet view that has allow additions property set to true. Record source of this form is set to select query based on 2 tables, here's query code:
Code:
SELECT tbTrucks.truckId, tbTrucks.plateNumbers, tbForwarder.forwarderDataFROM tbForwarder RIGHT JOIN tbTrucks ON tbForwarder.forwarderID = tbTrucks.forwarderId;
Now, when I fill in the last row I want it to behave like this:
- add new record to tbTrucks with plateNumbers I filled in
- check whether the forwarderData I filled in matches any existen tbForwarder record. If yes, put existent tbForwarder.forwarderId into tbTrucks.forwarderId. If the forwarder doesn't exist, add new record to tbForwarder and then put this new tbForwarder.forwarderId into tbTrucks.forwarderId.
Currently I end up with new tbForwarder record created even though the forwarder of data I entered already exists. In other words it doesn't check if forwarder already exists in tbForwarder and always creates new record for it. This way I end up with a bunch of exactly the same forwarder's data in separate records (hence treated as separate forwarders later). How can I work this around?
PS. Sorry if I didn't make it clear enough, the issue is quite complex and abstract as for my command of english.
Robert