Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / September 2007

Tip: Looking for answers? Try searching our database.

Union query garbles ID field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew - 12 Sep 2007 19:00 GMT
I can't figure out why this happens.  In some of my union queries, an ID
field gets garbled and displayed as a non-western character, or a box shape
of some sort.  It's like it's encoded?  Does anyone know why this might
happen?  I can post back with table & query descriptions.

Thank you!!

Matthew
Matthew - 12 Sep 2007 19:10 GMT
Here's my structure, simplified:

tblContacts
*ContactID
LastName
...

tblAffiliations
*AffiliationID
ContactID
Title
...

qryA:
SELECT tblAffiliations.AffiliationID, tblAffiliations.Title, Null AS
ContactID, Null AS LastName
FROM tblAffiliations;

qryC:
SELECT tblContacts.ContactID, tblContacts.LastName, Null AS AffiliationID,
Null AS Title
FROM tblContacts;

UnionQuery:
SELECT qryA.AffiliationID, qryA.Title, qryA.ContactID, qryA.LastName FROM
qryA

UNION SELECT qryC.AffiliationID, qryC.Title, qryC.ContactID, qryC.LastName
FROM qryC;

In the query results, all records that come from tblContacts have an
illegible, non-western character in the ContactID field.

Many thanks!!

Matthew

>I can't figure out why this happens.  In some of my union queries, an ID
>field gets garbled and displayed as a non-western character, or a box shape
[quoted text clipped - 4 lines]
>
> Matthew
giorgio rancati - 12 Sep 2007 20:16 GMT
Hi Matthew,

It's a problem of datatype allocation.
modify the queries like these
----
qryA:
SELECT
    tblAffiliations.AffiliationID,
    tblAffiliations.Title,
    Cvar(Null)+0 AS ContactID,
    Null AS LastName
FROM tblAffiliations;

qryC:
SELECT
    tblContacts.ContactID,
    tblContacts.LastName,
    Cvar(Null)+0 AS AffiliationID,
    Null AS Title
FROM tblContacts;
----

bye
--
Giorgio Rancati
[Office Access MVP]

> Here's my structure, simplified:
>
[quoted text clipped - 41 lines]
>>
>> Matthew
Matthew - 12 Sep 2007 21:30 GMT
Fantastic!

I don't (yet) know what  Cvar means, but it works!!

Thank you!!

Matthew

> Hi Matthew,
>
[quoted text clipped - 68 lines]
>>>
>>> Matthew
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.