I am using Srch code to find a record to my form!!!
my error code after running is "Compile error" Variable not found"
Private Sub Command5_Click()
sonny:
Select Case Field6
Case 1
Srch = "SELECT DISTINCTROW Product_Information_Q-Clad_Table1.id,Product_Information_Q-Clad_Table1.number,Product_Information_Q-Clad_Table1.Tech,Product_Information_Q-Clad_Table1.customer,Product_Information_Q-Clad_Table1.customer_partnumber,Product_Information_Q-Clad_Table1.cq_number,Product_Information_Q-Clad_Table1.bd_number,Product_Information_Q-Clad_Table1.cirqon_snumber,Product_Information_Q-Clad_Table1.customer_number,Product_Information_Q-Clad_Table1.quote_number,Product_Information_Q-Clad_Table1.last_quoted_date,Product_Information_Q-Clad_Table1.recent_wip,Product_Information_Q-Clad_Table1.last_pull_date,Product_Information_Q-Clad_Table1.part_status,Product_Information_Q-Clad_Table1.customer_service_rep,Product_Information_Q-Clad_Table1.manufactures_rep FROM Product_Information_Q-Clad_Table1 WHERE ((Product_Information_Q-Clad_Table1.bd_number=[Forms]![Find_a_record_form]![Field12]));"
Case 2
Srch = "SELECT DISTINCTROW Product_Information_Q-Clad_Table1.id,Product_Information_Q-Clad_Table1.number,Product_Information_Q-Clad_Table1.Tech,Product_Information_Q-Clad_Table1.customer,Product_Information_Q-Clad_Table1.customer_partnumber,Product_Information_Q-Clad_Table1.cq_number,Product_Information_Q-Clad_Table1.bd_number,Product_Information_Q-Clad_Table1.cirqon_snumber,Product_Information_Q-Clad_Table1.customer_number,Product_Information_Q-Clad_Table1.quote_number,Product_Information_Q-Clad_Table1.last_quoted_date,Product_Information_Q-Clad_Table1.recent_wip,Product_Information_Q-Clad_Table1.last_pull_date,Product_Information_Q-Clad_Table1.part_status,Product_Information_Q-Clad_Table1.customer_service_rep,Product_Information_Q-Clad_Table1.manufactures_rep FROM Product_Information_Q-Clad_Table1 WHERE ((Product_Information_Q-Clad_Table1.cq_number=[Forms]![Find_a_record_form]![Field12]));"
Case Else
GoTo sonny
End Select
Forms!Find_a_record_form.RecordSource = Srch
Forms!Find_a_record_form.Visible = False
End Sub
my error code after running is "Compile error" Variable not found"
Private Sub Command5_Click()
sonny:
Select Case Field6
Case 1
Srch = "SELECT DISTINCTROW Product_Information_Q-Clad_Table1.id,Product_Information_Q-Clad_Table1.number,Product_Information_Q-Clad_Table1.Tech,Product_Information_Q-Clad_Table1.customer,Product_Information_Q-Clad_Table1.customer_partnumber,Product_Information_Q-Clad_Table1.cq_number,Product_Information_Q-Clad_Table1.bd_number,Product_Information_Q-Clad_Table1.cirqon_snumber,Product_Information_Q-Clad_Table1.customer_number,Product_Information_Q-Clad_Table1.quote_number,Product_Information_Q-Clad_Table1.last_quoted_date,Product_Information_Q-Clad_Table1.recent_wip,Product_Information_Q-Clad_Table1.last_pull_date,Product_Information_Q-Clad_Table1.part_status,Product_Information_Q-Clad_Table1.customer_service_rep,Product_Information_Q-Clad_Table1.manufactures_rep FROM Product_Information_Q-Clad_Table1 WHERE ((Product_Information_Q-Clad_Table1.bd_number=[Forms]![Find_a_record_form]![Field12]));"
Case 2
Srch = "SELECT DISTINCTROW Product_Information_Q-Clad_Table1.id,Product_Information_Q-Clad_Table1.number,Product_Information_Q-Clad_Table1.Tech,Product_Information_Q-Clad_Table1.customer,Product_Information_Q-Clad_Table1.customer_partnumber,Product_Information_Q-Clad_Table1.cq_number,Product_Information_Q-Clad_Table1.bd_number,Product_Information_Q-Clad_Table1.cirqon_snumber,Product_Information_Q-Clad_Table1.customer_number,Product_Information_Q-Clad_Table1.quote_number,Product_Information_Q-Clad_Table1.last_quoted_date,Product_Information_Q-Clad_Table1.recent_wip,Product_Information_Q-Clad_Table1.last_pull_date,Product_Information_Q-Clad_Table1.part_status,Product_Information_Q-Clad_Table1.customer_service_rep,Product_Information_Q-Clad_Table1.manufactures_rep FROM Product_Information_Q-Clad_Table1 WHERE ((Product_Information_Q-Clad_Table1.cq_number=[Forms]![Find_a_record_form]![Field12]));"
Case Else
GoTo sonny
End Select
Forms!Find_a_record_form.RecordSource = Srch
Forms!Find_a_record_form.Visible = False
End Sub