SQL satement in VB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a buton that's,on click event,should change the form record
source,could anybody tell me how to chnange the recordsource of the form to
be the below SQL statment?,in other words how to run the below SQL staement
in a VB environment?

Form.RecordSource = "SELECT Escnew.code, Escnew.[Customer Name],
Escnew.Phone, Escnew.[E-mail], Escnew.Link, Escnew.[Installation ID],
Escnew.[Product Key], Escnew.PID, Escnew.[Part number], Escnew.[Product
Name], Escnew.Version, Escnew.[Confirmation ID], Escnew.Language,
Escnew.Country, Escnew.Contract, Escnew.[Authorization number],
Escnew.[License number], Escnew.[Enrolment number], Escnew.Quantity,
Escnew.Describe, Escnew.When, Escnew.URL, Escnew.[Error message],
Escnew.[Error Message2], Escnew.Status, Escnew.Custime, Escnew.Cusagent,
Escnew.Esctime, Escnew.Escagent, Escnew.SRN, Escnew.[Program ID], Escnew.[SAP
ID], Escnew.ProductSPLA, Escnew.Company, Escnew.[Final reply], Escnew.[Case
Status], Escnew.[Receiving date2], Escnew.Sent"
FROM Escnew LEFT JOIN Customersupport2 ON Escnew.code = Customersupport2.Code2
WHERE (((Escnew.SRN)="Defective escalation") AND ((Customersupport2.Code2)
Is Null));
 
Hi!

Try on button click after your code:
Form.RecordSource = "SELECT Escnew.code, Escnew.[Customer Name],
Escnew.Phone, Escnew.[E-mail], Escnew.Link, Escnew.[Installation ID],
Escnew.[Product Key], Escnew.PID, Escnew.[Part number], Escnew.[Product
Name], Escnew.Version, Escnew.[Confirmation ID], Escnew.Language,
Escnew.Country, Escnew.Contract, Escnew.[Authorization number],
Escnew.[License number], Escnew.[Enrolment number], Escnew.Quantity,
Escnew.Describe, Escnew.When, Escnew.URL, Escnew.[Error message],
Escnew.[Error Message2], Escnew.Status, Escnew.Custime, Escnew.Cusagent,
Escnew.Esctime, Escnew.Escagent, Escnew.SRN, Escnew.[Program ID], Escnew.[SAP
ID], Escnew.ProductSPLA, Escnew.Company, Escnew.[Final reply], Escnew.[Case
Status], Escnew.[Receiving date2], Escnew.Sent"
FROM Escnew LEFT JOIN Customersupport2 ON Escnew.code = Customersupport2.Code2
WHERE (((Escnew.SRN)="Defective escalation") AND ((Customersupport2.Code2)
Is Null));


add a row-
form.requery()
and should be OK!:)

Dexter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top