Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 20th, 2005, 09:26 AM
tdnet tdnet is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 5 tdnet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What's wrong with my syntax ?

Can someone tell me what's wrong with my syntax? Please.



Set rst=dbs.OpenRecordSet("Select [MainPhone],[MainPhoneExt] from [tblProvider] where [ProviderID]= "& Me.txtField11)

Reply With Quote
  #2  
Old January 20th, 2005, 10:49 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
I agree...what is wrong with it...looks fine to me. What error are you getting? As long as [ProviderID] is a number and Me.txtField11 is a number it will work. I am also assuming that tblProvider is not a Linked Table. If it is you will need to declare the type of recordset you are opening. The default setting is dbOpenTable if not declared and cannot be used with Linked Tables.

lwells

Reply With Quote
  #3  
Old January 20th, 2005, 12:48 PM
tdnet tdnet is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 5 tdnet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It is a linked table. My db was created in the 97 version of Access and worked fine as written. I have recently converted it to 2002 and now get this:

Run-time error '3075':
Syntax error (missing operator) in query expression '[ProviderID]='.

Would the correct syntax using a linked table be:

Set rst=dbs.LinkedRecordSet("Select [MainPhone],[MainPhoneExt] from [tblProvider] where [ProviderID]= "& Me.txtField11)

or can the default be altered, overwritten, or otherwise bi-passed?

Thanks for your help!

Reply With Quote
  #4  
Old January 20th, 2005, 01:28 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
First, I may have missed this originally but it looks like you may also be missing a space between the "& in the last part of the syntax:

[ProviderID]= "& Me.txtField11)

Should look like this:
[ProviderID]= " & Me.txtField11)

Secondly, using a linked table you will need to declare the type of recordset,

Set rst=dbs.OpenRecordSet("Select [MainPhone],[MainPhoneExt] from [tblProvider] where [ProviderID]= " & Me.txtField11, dbOpenDynaset)

Or

Set rst=dbs.OpenRecordSet("Select [MainPhone],[MainPhoneExt] from [tblProvider] where [ProviderID]= " & Me.txtField11, dbOpenSnapshot)


See if that will solve the problem.

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > What's wrong with my syntax ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT