DeeDee Baldwin
asked on
How do I get fix code to not get Run time Error 2147217900
I am trying to troubleshoot a database that after the user enter the necessary dates and hit enter gets a run time error 2147217900(80040e14) Synatx error (missing operator) in query expression [ItemNumber] > 0 and [SwitchboardID]=" & Me.[SwitchboardID]
Below is the Code
' Open the table of Switchboard Items, and find
' the first item for this Switchboard Page.
Set con = Application.CurrentProject .Connectio n
stSql = "SELECT * FROM [Switchboard Items]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me.[SwitchboardID]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Record set")
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
Could someone please help. Thanks
Below is the Code
' Open the table of Switchboard Items, and find
' the first item for this Switchboard Page.
Set con = Application.CurrentProject
stSql = "SELECT * FROM [Switchboard Items]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me.[SwitchboardID]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Record
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
Could someone please help. Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also make sure you've spelled everything correctly.
You don't use CreateObject ti instantiate a recordset in Access
You don't TYPICALLY use CreateObject to build a Recordst, but there's nothing wrong with using CreateObject to build a Recordset (other than you don't get Intellisense).
In fact there is a new issue out that could force you to use Late Binding to build ADO recordsets:
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/3a4ce946-effa-4f77-98a6-34f11c6b5a13/?prof=required
Seems that Servic Pack 1 for Win7 can break the mosadoxx.dll associations (the ID for that interface changed), which means you must either (a) register an earlier version of that TypeLib or (b) user Late Binding.
In fact there is a new issue out that could force you to use Late Binding to build ADO recordsets:
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/3a4ce946-effa-4f77-98a6-34f11c6b5a13/?prof=required
Seems that Servic Pack 1 for Win7 can break the mosadoxx.dll associations (the ID for that interface changed), which means you must either (a) register an earlier version of that TypeLib or (b) user Late Binding.