Attachment in 1:n query

jan@BRU

Registered User.
Local time
Yesterday, 23:16
Joined
Jul 18, 2007
Messages
39
This is probably an easy question, but the issues drives me n...

Consider a situation, where I have 1:n relation between 2 tables, say:

tblSupplier, with fields: SupplierID, AllKindsofInformation, CountryID

tblCountry, with fields: CountryID, CountryName, Flag


With all fields being strings, besides Flag, with is a Microsoft Access 2007 attachment. There is an obvious n:1 relationship between tblSupplier and tblCountry, linked via the CountryID field.

I now create a query, which displays and allows to add new records, straightforward again:

SELECT tblSupplier.SupplierID, tblSupplier.AllKindsofInformation, tblSupplier.CountryID, tblCountry.CountryName
FROM tblCountry INNER JOIN tblSupplier ON tblCountry.CountryID = tblSupplier.CountryID;

This works very well.

Now here is where the problem starts: If I add the the Attachment field (.jpg file for the flag of the, or any other attachment related to the country table),

SELECT tblSupplier.SupplierID, tblSupplier.AllKindsofInformation, tblSupplier.CountryID, tblCountry.CountryName, tblCountry.Flag
FROM tblCountry INNER JOIN tblSupplier ON tblCountry.CountryID = tblSupplier.CountryID;

the query still displays correctly, but as soon as I'm trying to add a record, and I add the CountryID field, the attached error message appears.

This is pretty strange, as one can see in the previous record, there is already an entry with the "UK" CountryID in the tblCountry table, so the error message is quite misleading. Also, the problem only occurs, when the tblCountry.Flag field is part of the query. If it is not, I can add a new record without any problem.

Finally, why do I include the flag field? If I want to use it in a form, I want the flag to appear as a picture, as soon as I set the countryID field. Although, I don't understand why this query is not working, I was already thinking about a workaround, and Dlookup the flag, so to avoid to make the attachment part of the query. But then, I don't know, how to Dlookup an attachment neither:(



Any help for problem one (and/or) two?



Many thanks



Jan
 

Attachments

  • ErrorMessage.jpg
    ErrorMessage.jpg
    43.9 KB · Views: 141
I haven't used A2007, but I suspect this is the usual error you get when you have a table level lookup defined. The ID is stored but the text value is displayed.
 
I'm afraid, I don't understand. Is there anybody, who can help on this?

Many thanks
 
Do you have a table level lookup defined?
 

Users who are viewing this thread

Back
Top Bottom