S
Stephen
I have a form called Diary_Sales and it lists all appointments for the Sales
Reps for a particular date which is entered by the user, being the field
txtDate.
I used to use a subform based on a query and had to requery the subform to
get the right data to appear, also users could filter based on Sales Rep and
if they tried to change date after filtering, it would not requery, but
would now like to use code (have been trying to use more code than queries)
have the following code
Dim strDBconn
Dim InputString As String
Dim DiaryRecords
Set strDBconn = CurrentDb
InputString = "SELECT Quotation.Job_No, Quotation.Quote_No,
Quotation.Appointment_date, Quotation.Appointment_time,
Customer.Customer_Surname, Customer.Customer_Phone_AH, Quotation.Comments,
Quotation.Sales_rep, T_Employee.Employee_ID, T_Employee.Employee_First_Name,
Customer.Customer_Suburb, Quotation.Job_status, Quotation.item_List,
Quotation.Personal FROM T_Employee INNER JOIN (Customer RIGHT JOIN Quotation
ON Customer.Customer_ID = Quotation.Customer_ID) ON T_Employee.Employee_ID =
Quotation.Sales_rep WHERE Quotation.Appointment_date = " & Me![txtDate]
Set DiaryRecords = strDBconn.OpenRecordset(InputString)
If DiaryRecords.RecordCount > 0 Then
'fill quotation details
Job_No = DiaryRecords(0)
Employee_First_Name = DiaryRecords(10)
Appointment_date = DiaryRecords(2)
Appointment_time = DiaryRecords(3)
Customer_Suburb = DiaryRecords(11)
Customer_Surname = DiaryRecords(4)
Customer_Phone_AH = DiaryRecords(5)
item_List = DiaryRecords(13)
Personal = DiaryRecords(14)
Quote_No = DiaryRecords(1)
End If
Can anyone point me in the right direction as to how I code this.
TIA
Stephen
Reps for a particular date which is entered by the user, being the field
txtDate.
I used to use a subform based on a query and had to requery the subform to
get the right data to appear, also users could filter based on Sales Rep and
if they tried to change date after filtering, it would not requery, but
would now like to use code (have been trying to use more code than queries)
have the following code
Dim strDBconn
Dim InputString As String
Dim DiaryRecords
Set strDBconn = CurrentDb
InputString = "SELECT Quotation.Job_No, Quotation.Quote_No,
Quotation.Appointment_date, Quotation.Appointment_time,
Customer.Customer_Surname, Customer.Customer_Phone_AH, Quotation.Comments,
Quotation.Sales_rep, T_Employee.Employee_ID, T_Employee.Employee_First_Name,
Customer.Customer_Suburb, Quotation.Job_status, Quotation.item_List,
Quotation.Personal FROM T_Employee INNER JOIN (Customer RIGHT JOIN Quotation
ON Customer.Customer_ID = Quotation.Customer_ID) ON T_Employee.Employee_ID =
Quotation.Sales_rep WHERE Quotation.Appointment_date = " & Me![txtDate]
Set DiaryRecords = strDBconn.OpenRecordset(InputString)
If DiaryRecords.RecordCount > 0 Then
'fill quotation details
Job_No = DiaryRecords(0)
Employee_First_Name = DiaryRecords(10)
Appointment_date = DiaryRecords(2)
Appointment_time = DiaryRecords(3)
Customer_Suburb = DiaryRecords(11)
Customer_Surname = DiaryRecords(4)
Customer_Phone_AH = DiaryRecords(5)
item_List = DiaryRecords(13)
Personal = DiaryRecords(14)
Quote_No = DiaryRecords(1)
End If
Can anyone point me in the right direction as to how I code this.
TIA
Stephen