Jump to content

Recommended Posts

Posted

Boas

No código abaixo, não consigo fazer a pesquisa através da data, se meter a data a mão! Funciona mas se usar a variavel da data não dá rebenta logo :c

Penso que seja por a data ir assim (03-06-2014)..

Alguem me consegue ajudar?

Dim conn As Object
Set conn = CreateObject("ADODB.Connection")
Dim data_time As String
data_time = Format(Date, "MM/dd/yyyy")

Dim cn As Object
   Dim rs As Object
   Dim strSQL As String
   Dim strConnection As String

   Set cn = CreateObject("ADODB.Connection")
   strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
   "Data Source=C:\QA\QA\NEW V1.0\Mapa Pesos e Ciclos.mdb"
   'strSQL = "SELECT molde FROM historico WHERE molde = ('" & txt_mold & "')"
   strSQL = "SELECT molde, data FROM historico WHERE molde = ('" & txt_mold & "') and data = (data_time)"
   cn.Open strConnection
   Set rs = cn.Execute(strSQL)

 If rs.EOF = False Then
  MsgBox ("Esse registo já existe!!")
  Else
  MsgBox (".|.")
 End If
   rs.Close
   Set rs = Nothing
   cn.Close
   Set cn = Nothing

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.