|
-
Mar 16th, 2009, 12:55 AM
#1
Thread Starter
Member
-
Mar 16th, 2009, 01:00 AM
#2
Re: The Select statement includes a reserved word or an argument name that is misspelled
Please mark you thread resolved using the Thread Tools as shown
-
Mar 16th, 2009, 01:39 AM
#3
Thread Starter
Member
Re: The Select statement includes a reserved word or an argument name that is misspelled
iam using VB6 ADO and access in back end
-
Mar 16th, 2009, 01:46 AM
#4
Re: The Select statement includes a reserved word or an argument name that is misspelled
As for as the Screen shot you have posted i could see that the Name is the Keyword for the Access. If you want to use the Name field in your query cover the field with [] like
Code:
Select [Name] from YourTable
List of Access Keywords
Please mark you thread resolved using the Thread Tools as shown
-
Mar 16th, 2009, 02:07 AM
#5
Thread Starter
Member
Re: The Select statement includes a reserved word or an argument name that is misspelled
the keyword is the month and year.
in a given example it is the the month 3 and year 2009
which means march 2009
in my datagrid i want it to display all the records on my database
having the month "3" and year "2009" or march 2009
below is the code in the VIEW RECORD command..
Code:
Private Sub Command2_Click()
Dim lastdate As Date
On Error GoTo errhandler
mySql = "SELECT From db3 WHERE lastdate= MONTH(date)=" & (lblmonth.Caption) & " AND YEAR(date)=" & (lblyear.Caption) & " GROUP BY YEAR(date),MONTH(date)"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\vb6\db3.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = mySql
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
DataGrid1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
errhandler:
MsgBox "NO record"
Else
MsgBox Err.Description
MsgBox Err.Number
End If
End Sub
-
Mar 16th, 2009, 02:14 AM
#6
Re: The Select statement includes a reserved word or an argument name that is misspelled
you are not retrieving any columns from the table ?
Code:
mySql = "SELECT From db3 WHERE lastdate= MONTH(date)=" & (lblmonth.Caption) & " AND YEAR(date)=" & (lblyear.Caption) & " GROUP BY YEAR(date),MONTH(date)"
Should be
Code:
mySql = "SELECT * From db3 WHERE lastdate= MONTH(date)=" & (lblmonth.Caption) & " AND YEAR(date)=" & (lblyear.Caption) & " GROUP BY YEAR(date),MONTH(date)"
Please mark you thread resolved using the Thread Tools as shown
-
Mar 16th, 2009, 02:46 AM
#7
Thread Starter
Member
Re: The Select statement includes a reserved word or an argument name that is misspelled
ooppss sorry it must be the name of the table not the database file ^^
db3=table1.. ehhehehe..
and the date must be in the one in my field in the database? ^^
date=last_date
i have already update my attatchment
hmmm...
for those who will run my program must be located at C:\My Documents ^_^
danasegarane i have already put an *
Code:
mySql = "SELECT *From table1 WHERE last_date=MONTH(last_date)=" & (lblmonth.Caption) & " AND YEAR(last_date)=" & (lblyear.Caption) & " GROUP BY YEAR(last_date),MONTH(last_date)"
but i've the following error message:
cannot group on fields selected with '*'
-
Mar 16th, 2009, 03:42 AM
#8
Re: The Select statement includes a reserved word or an argument name that is misspelled
What are the fields you are trying to display ?
Please mark you thread resolved using the Thread Tools as shown
-
Mar 16th, 2009, 03:48 AM
#9
Thread Starter
Member
Re: The Select statement includes a reserved word or an argument name that is misspelled
the field name only
in my example in will display on the datagrid
name
aaa
bbb
ccc
ddd
eee
fff
ggg
hhh
as the last_date field is = to 3/2009
which is my input on the lblmonth.caption = 3
and lblyear.caption = 2009
-
Mar 16th, 2009, 04:49 AM
#10
Re: The Select statement includes a reserved word or an argument name that is misspelled
Try
vb Code:
mySql = "SELECT [Name],last_date,[id]From table1 WHERE last_date=MONTH(last_date)=" & (lblmonth.Caption) & " AND YEAR(last_date)=" & (lblyear.Caption) & " GROUP BY YEAR(last_date),MONTH(last_date),[Name],[id],last_date"
Please mark you thread resolved using the Thread Tools as shown
-
Mar 16th, 2009, 05:21 AM
#11
Thread Starter
Member
Re: The Select statement includes a reserved word or an argument name that is misspelled
using that code.. theirs no error message anymore..
but
still not able to display the data on my datagrid
i really try coding but still nothing happen
vb6.rar
tnx danasegarane for helping me
-
Mar 16th, 2009, 05:48 AM
#12
Thread Starter
Member
-
Mar 16th, 2009, 05:54 AM
#13
Re: The Select statement includes a reserved word or an argument name that is misspelled
I don't have access to test. Did you try the query in Query Analyzer?
may be there will be no data for the particular condition
Please mark you thread resolved using the Thread Tools as shown
-
Mar 16th, 2009, 09:21 AM
#14
Thread Starter
Member
Re: [RESOLVED] The Select statement includes a reserved word or an argument name that is misspelled
nope i didnt try that...
but its now working well...
tnx
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
|