|
-
Aug 6th, 2003, 12:57 PM
#1
Thread Starter
Addicted Member
where is the error???
I've got made a macro command with this code :
Sub AdoRefresh()
Dim rs As New ADODB.Recordset
Dim userentry As String
Dim strdtfrom As String
Dim strdtto As String
Dim sql1 As String
Dim intCount As Integer
intCount = 1
strdtfrom = "01/07/2003"
strdtto = "07/07/2003"
userentry = "247"
Worksheets("test").Range("A2:C2000").ClearContents
Dim Connect As String
sql1 = "SELECT DOCUMENTS.f_docnumber, DOCUMENTS.date as DateTime FROM DOCUMENTS WHERE date >= TO_DATE ('" + strdtfrom + "', 'DD/MM/RRRR') AND date < TO_DATE ('" + strdtto + "', 'DD/MM/RRRR') AND user = " + userentry + " ORDER BY date"
Connect = "Provider=MSDAORA;Password=pass;User ID=userid;Data Source=mydb"
rs.Open sql1, Connect
' Set header values for sheet 1.
With Worksheets("test").Rows(1)
.Font.Bold = True
.Cells(2, 1).Value = "RowNum"
.Cells(2, 2).Value = "Doc"
.Cells(2, 3).Value = "Date & Time"
.Cells(2, 4).Value = "Total Time"
End With
With rs
Do While Not .EOF
Sheets("test").Cells(intCount + 2, 2) = !f_docnumber
intCount = intCount + 1
.MoveNext
Loop
End With
End Sub
i got error(1004) on this line:
Sheets("test").Cells(intCount + 2, 2) = !f_docnumber
but i can't underestand why seems everything o.k.
any suggestions ?????
Last edited by alazarou; Aug 6th, 2003 at 01:51 PM.
-
Aug 6th, 2003, 01:04 PM
#2
I'm going to guess that "f_docnumber" is a field in the recordset, right?
if so !f_docnumber won't work....
BUT, rs!f_docnumber will....
The ! notation with recordset doesn't work within the With rs structure.... the With is only a shortcut to the object model, it has no effect on the recordset itself.
-
Aug 6th, 2003, 01:38 PM
#3
Thread Starter
Addicted Member
no doesn't work with rs!f_docnumber
the same error in the same line
-
Aug 6th, 2003, 01:56 PM
#4
Thread Starter
Addicted Member
I tryed this:
I changed the field name f_docnumber(number)
with an other from the same table f_docname(varchar) and the code works.
so, is there anyone who knows why doesn't work with numbers???
-
Aug 6th, 2003, 02:11 PM
#5
Thread Starter
Addicted Member
i get it!!!!!!
Cstr(rs!f_docnumber)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|