PDA

View Full Version : .adb code problem



lynn_victoria
02-02-2005, 09:59 AM
Microsoft provides a template db called Events Management.mdb which I have used for a couple of years with great success. This year the company has decided to make the move to SQL Server so I upgraded my template .mdb to a .adp (Access Data Project). Thinking this would be easy :rofl

IN THE MDB THE REGISTRATION FORM HAS THIS ROWSOURCE:

SELECT DISTINCTROW Registration.*
FROM Attendees INNER JOIN Registration
ON Attendees.AttendeeID = Registration.AttendeeID
WHERE (((Registration.AttendeeID)=[forms]![Attendees]![AttendeeID]));


IN THE ADP I HAVE CHANGED THE CODE TO THIS:

SELECT DISTINCT Registration.*
FROM Attendees INNER JOIN Registration
ON Attendees.AttendeeID = Registration.AttendeeID
WHERE (((Registration.AttendeeID)=[forms].[Attendees].[AttendeeID]));

AND VOILA IT FAILS! No problem I am new to this transition, please don't shoot me.
It says:
Error in SELECT clause: expression near '.'
Unable to parse query text

I changed the ! to '.' because it didn't like the '!' either. Any insight?

nico5038
02-05-2005, 04:02 AM
Hmm, I'm afraid you'll have to place the value from the form into the recordsource.
Best probably to use in the form's OnOpen event:
me.recordsource = "SELECT DISTINCTROW Registration.*
FROM Attendees INNER JOIN Registration
ON Attendees.AttendeeID = Registration.AttendeeID
WHERE (((Registration.AttendeeID)=" & [forms]![Attendees]![AttendeeID] & "));"

This does however require the "Attendees" form to be open and the field to be filled.

Nic;o)