I've been trying to make a field (Cities) in a joined table update to reflect when a new city entry is made in a form where the city is not already included in the cities tbl. Each city has a unique autonumber, which serves as the primary key. If I were to use the city name itself as a primary key, i know a variation of this MVB code would work:
If Len(Nz(Me.[tblCity.City], "")) = 0 Then
Me.[tblCity.City]=[tblComputers.City]
End If
But since each city has an ID and that is what is linking it to the foreign key in the table, (and I'm using a multibox to look up the city name itself through the city ID number), using this code would only work if the joining factor was the city name itself. Help! Any thoughts would be appreciated. Am I doing this linking properly, or should I just use the city name? I was under the impression that it is always much better to join with numbers rather than strings, so I have been trying to avoid making this change. Finding a way to do it in its current state would certainly eliminate some redundancy.
If Len(Nz(Me.[tblCity.City], "")) = 0 Then
Me.[tblCity.City]=[tblComputers.City]
End If
But since each city has an ID and that is what is linking it to the foreign key in the table, (and I'm using a multibox to look up the city name itself through the city ID number), using this code would only work if the joining factor was the city name itself. Help! Any thoughts would be appreciated. Am I doing this linking properly, or should I just use the city name? I was under the impression that it is always much better to join with numbers rather than strings, so I have been trying to avoid making this change. Finding a way to do it in its current state would certainly eliminate some redundancy.