|
-
Aug 27th, 2007, 02:50 AM
#1
Thread Starter
Member
[RESOLVED] what to do if table head contains bracket
I have a table with one field name "Time (Date + Hour)". Now when I write the code
Code:
strSQL = "SELECT [Time (Date + Hour)] FROM tblName"
rs.CursorLocation = adUseClient
rs.Open strSQL, con, adOpenDynamic, adLockOptimistic
MsgBox rs(Time (Date + Hour))
It shows error code. How can I read the value then?
-
Aug 27th, 2007, 02:54 AM
#2
-
Aug 27th, 2007, 03:13 AM
#3
Thread Starter
Member
Re: what to do if table head contains bracket
I dont have any problem with SQL. It works fine. But when i want to get values from recordset, Like rs(Time (Date + Hour)), then the problem arises.
And, I can't change the field name, because of some regulation.
-
Aug 27th, 2007, 03:21 AM
#4
Re: what to do if table head contains bracket
The first line
strSQL = "SELECT [Time (Date + Hour)] FROM tblName"
is Ok.
The problem is in line
MsgBox rs(Time (Date + Hour))
It should be:
MsgBox rs![Time (Date + Hour)]
or
MsgBox rs("Time (Date + Hour)")
-
Aug 27th, 2007, 10:18 PM
#5
Thread Starter
Member
Re: what to do if table head contains bracket
thanx a lot .. So fool of me! .. I should try that before.. Now I'll try
-
Aug 28th, 2007, 11:05 PM
#6
Thread Starter
Member
Re: [RESOLVED] what to do if table head contains bracket
But it
Code:
MsgBox rs![Time (Date + Hour)]
does not work !!!!!!!!!!!!
-
Aug 28th, 2007, 11:20 PM
#7
Re: [RESOLVED] what to do if table head contains bracket
Try to learn the syntax yourself and you will know what you have to do when the field name contains spaces and orther non-alphanumeric character.
-
Aug 29th, 2007, 12:30 AM
#8
Thread Starter
Member
Re: [RESOLVED] what to do if table head contains bracket
sorry pal, thought that as I had the opportunity to ask the vb wizards, it may save my time, becoz I am new and really in hurry. Anyway, thanx 4 all ur help. Btw, my problem is solved.
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
|