Senin, 23 April 2012

RE: [MS_AccessPros] Re: Fixing a default value for a table.

 

Robin-

Well, the Union query returns a Null for RegistrantID for the "next" meeting.
What is it you're really trying to do?

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Villefranche-sur-mer, France)

------------------------------------

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Robin Chapple
Sent: Monday, April 23, 2012 2:42 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] Re: Fixing a default value for a table.

 
Thanks Bill,

I have built my UNION query as explained by you:

SELECT tRegistrants.RegistrantID, tRegistrants.ClubID,
tRegistrants.MemberID, tRegistrants.PostHolderID,
tRegistrants.MeetingID, tRegistrants.ChoiceID, tRegistrants.LastUpdated
FROM tRegistrants, tNextMeeting

UNION SELECT Null as RegistrantID, Null as ClubID, null as MemberID,
Null as PostHolderID, tNextMeeting.MeetingID, Null as ChoiceID,
tNextMeeting.LastUpdate
FROM tNextMeeting;

and, because the code generator that I use, I have made a standard
query to lodge on the web based server:

SELECT Meetingz.RegistrantID, Meetingz.ClubID, Meetingz.MemberID,
Meetingz.PostHolderID, Meetingz.MeetingID, Meetingz.ChoiceID,
Meetingz.LastUpdated
FROM Meetingz, tNextMeeting
WHERE (((Meetingz.LastUpdated)>[LastUpdate]-1));

which fails to give me a "RegistrantID" in spite of the fact that the
table "tRegistrants" has "RegistrantID" as an auto number field. As a
result the fails due to the 'null'.

Am I asking too much?

Many thanks,

Robin

At 23/04/2012 02:29 AM, you wrote:
>Robin
>
>You can trick a UNION query by plugging extra fields in the right slots. Say
>tbl1 has 4 fields and tbl2 has 2. The UNION would look like this:
>
>SELECT LastName, FirstName, MeetingDate, MeetingLocation
>
>FROM tbl1
>
>UNION
>
>SELECT Null as LastName, Null as FirstName, MeetingDate, MeetingLocation
>
>FROM tbl1
>
>
>
>
>
>Regards,
>Bill Mosca,
>Founder, MS_Access_Professionals
>That'll do IT <http://thatlldoit.com/> http://thatlldoit.com
>MS Access MVP
> <https://mvp.support.microsoft.com/profile/Bill.Mosca>
>https://mvp.support.microsoft.com/profile/Bill.Mosca
>
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar