Odd recordset problem when loading form

bjreb

Registered User.
Local time
Today, 20:33
Joined
May 7, 2001
Messages
37
I have a form thats bases on a recordset. A query string is passes to the form as openarg and the recordset is generated. The query can be run two ways but the resulting fields all have the same names. The form loads no problem when the query is run one way, but the other way it crashes the whole database. I have tried to trap an error in the form but can not find it. In stepping through the code everything works fine until i get to the end of the form.current. as soon as I step through the end sub the program craps out.

Any ideas?

Thanks

Andy
 
Here it is
SELECT b.DT_DATE_BOOKED, b.DT_DATE_COMPLETED,b.TXT_REFUSED_REASON, b.IMG_PHOTO_ONE AS img_image,b.INT_CUSTOMER_NUMBER as customer, c.SalespersonName as [salesman name],c.CustomerName as customername, c.AddressOne,b.int_rejected as int_reject,c.City, a.TXT_BRAND_KEY FROM TBL_DISPLAY_DATA a INNER JOIN TBL_HANDHELD_DATA b ON a.TXT_DISPLAY_FULL_NAME = b.TXT_DISPLAY_FULL_NAME INNER JOIN HorizonSalesMart.dbo.Star_Sales_Customer C ON b.INT_CUSTOMER_NUMBER = c.Customer AND b.TXT_SALESMAN_NUMBER = c.Salesperson WHERE a.txt_brand_key in ('045403') and b.txt_Salesman_NUMBER between '1' and '700' and c.company in ('1','2','4') and c.division in ('1','2','3','4','0','5','21','22','9','10','11','12') and b.DT_DATE_BOOKED between '5/1/2008' and '5/16/2008' order by c.salespersonname Asc,c.customername ASC

The underlined text is the part of the string is the part that changes at run time. It can also read b.DT_DATE_BOOKED is not null

It all depends if they enter dates into the info collection form

Andy
 
Is this SQL being used on SQL Server or just in Access? If just in Access you need to use date delimiters:
b.DT_DATE_BOOKED between #5/1/2008# and #5/16/2008#
 
Its being sent to SQLServer through an adodb connection
 

Users who are viewing this thread

Back
Top Bottom