Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

Numeric variable in a SQL statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jack - 24 Feb 2005 14:17 GMT
I am getting a errror of mismatching type in a SQL.
My searchinf field is long interger (primary key) and I couldn't find how to
pass it as numeric variable to the SQL statement. It is assuming always
assuming it as text.

I tried already the following, statements w/o sucess:

notes: getID is a long variable (which store the value of a control in a
form - (see next)
         ShowIDtoChange is a control in a form

Statments tried:

Set rst = dbs.OpenRecordset("SELECT T_ListToReclass.IDCOP FROM
T_ListToReclass WHERE
(((T_ListToReclass.IDCOP)=[Forms]![F_Main]![ShowIDtoChange]));

'Set rst = dbs.OpenRecordset("SELECT T_ListToReclass.IDCOP FROM
T_ListToReclass WHERE
(((T_ListToReclass.IDCOP)=[Forms]![F_Main]![ShowIDtoChange]));")

'Set rst = dbs.OpenRecordset("select * from T_ListToReclass Where IDCOP='" +
getID + "'", dbOpenDynaset)

'Set rst = dbs.OpenRecordset("select * from T_ListToReclass Where
IDCOP=getID", dbOpenDynaset)

Thanks in advance for your help.
Thanks
Nikos Yannacopoulos - 24 Feb 2005 14:30 GMT
Jack,

Try something like:

strSQL = "SELECT T_ListToReclass.IDCOP FROM T_ListToReclass"
strSQL = strSQL & " WHERE T_ListToReclass.IDCOP)="
strSQL = strSQL & [Forms]![F_Main]![ShowIDtoChange]
Set rst = dbs.OpenRecordset(strSQL)

HTH,
Nikos

> I am getting a errror of mismatching type in a SQL.
> My searchinf field is long interger (primary key) and I couldn't find how to
[quoted text clipped - 25 lines]
> Thanks in advance for your help.
> Thanks
Lippi - 25 Feb 2005 00:28 GMT
Jack is a good friend and introduced me to this new group and proposed the
question in my behaft. Now I am a user also!!
Thanks Niko - your tip works perfectly.
See you around...(:
Lippi

> I am getting a errror of mismatching type in a SQL.
> My searchinf field is long interger (primary key) and I couldn't find how to
[quoted text clipped - 25 lines]
> Thanks in advance for your help.
> Thanks
Nikos Yannacopoulos - 25 Feb 2005 08:26 GMT
Lippi,

Glad it worked. Welcome to the NG's, I'm sure we'll hear more of you.

Regards,
Nikos

> Jack is a good friend and introduced me to this new group and proposed the
> question in my behaft. Now I am a user also!!
[quoted text clipped - 31 lines]
>>Thanks in advance for your help.
>>Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.