Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why....

    note:the filed have a blank into name

    SQL1 = "SELECT [DATA CENSIMENTO], [CODICE AGENZIA] FROM VERSAMENTI"
    RS.Open SQL1, cnDB, adOpenKeyset, adLockPessimistic, adCmdTable

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can only use adCmdTable to open a table, not for an SQL text string. Change adCmdTable to adCmdText.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='800299' date='28-Oct-2009 15:20']You can only use adCmdTable to open a table, not for an SQL text string. Change adCmdTable to adCmdText.[/quote]

    Hi frind is a good idea to loop the records and modify thaths with the sql in code.
    In effect i want to use the same value into record and update it with the value,....
    But have error...


    Code:
    Sub TEST_DATE_TAB()
    
    	On Error GoTo errore
    
    	Dim TEST As String
    	Set RS = New ADODB.Recordset
    
    	SQL1 = "SELECT [DATA CENSIMENTO],[CODICE AGENZIA] FROM VERSAMENTI"
    	RS.Open (SQL1), cnDB, adOpenKeyset, adLockPessimistic, adCmdText
    
    	RS.MoveFirst
    	Do While Not RS.EOF
    	
    		TEST = RS(0)
    		RS(0) = Right(TEST, 2) & "/" & Mid(TEST, 6, 2) & "/" & Left(TEST, 4)
    		TEST = RS(1)
    		RS(1) = Format((TEST * 1), "#0000")
    		
    	RS.Update
    		RS.MoveNext
    
    	Loop
    
    	RS.Close
    	Set RS = Nothing
    
    	Exit Sub
    
    errore:
    	MsgBox "Errore Numero: " & CStr(Err.Number) & vbCrLf & _
    		   "Descrizione: " & Err.Description & vbCrLf & _
    		   "Sorgente dell'Errore: " & Err.Source
    
    	Err.Clear
    
    	Application.ScreenUpdating = True
    	Application.Calculation = xlCalculationAutomatic
    
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Is Versamenti a table in the same database that contains the code, or does it reside in another database?

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='800308' date='28-Oct-2009 15:44']Is Versamenti a table in the same database that contains the code, or does it reside in another database?[/quote]


    NO... the code reside in a vba for excel project...

  6. #6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •