J
jeff
Hi gurus!
I am running a simple append query to bulk add records into a booking table.
For each booking added I want to include a unique Booking reference
calculated from a Function.
The Function reads a Booking reference format and last number from an Access
table increments it, writes it back to the table and then returns the
formatted Booking reference.
The problem I am having is that the Booking reference function is only being
called once and all the appended bookings have the same Booking Ref.
SQL is :-
INSERT INTO tblMain_CourseBookings ( SchedCourseID, BookingRef, CompanyID,
BookingType, PONo )
SELECT DISTINCT tblMain_CoursesScheduled.SchedCourseID, getNextBookNo() AS
BookingRef, tblMain_CoursesScheduled.CompanyID, "Company" AS BookingType,
ImportedData.PONo
FROM (tblMain_CoursesScheduled INNER JOIN ImportedData ON
tblMain_CoursesScheduled.SchedCourseRef = ImportedData.TARCode) INNER JOIN
tblMain_Company ON ImportedData.CompanyRef = tblMain_Company.CompanyCode;
This is being run as an Access Query def.
Funtion is getNextBookNo() - nothing complex in it and it does the job when
the bookings are being made thru the forms interface.
Can anyone help me out?
cheers
Jeff
I am running a simple append query to bulk add records into a booking table.
For each booking added I want to include a unique Booking reference
calculated from a Function.
The Function reads a Booking reference format and last number from an Access
table increments it, writes it back to the table and then returns the
formatted Booking reference.
The problem I am having is that the Booking reference function is only being
called once and all the appended bookings have the same Booking Ref.
SQL is :-
INSERT INTO tblMain_CourseBookings ( SchedCourseID, BookingRef, CompanyID,
BookingType, PONo )
SELECT DISTINCT tblMain_CoursesScheduled.SchedCourseID, getNextBookNo() AS
BookingRef, tblMain_CoursesScheduled.CompanyID, "Company" AS BookingType,
ImportedData.PONo
FROM (tblMain_CoursesScheduled INNER JOIN ImportedData ON
tblMain_CoursesScheduled.SchedCourseRef = ImportedData.TARCode) INNER JOIN
tblMain_Company ON ImportedData.CompanyRef = tblMain_Company.CompanyCode;
This is being run as an Access Query def.
Funtion is getNextBookNo() - nothing complex in it and it does the job when
the bookings are being made thru the forms interface.
Can anyone help me out?
cheers
Jeff