If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > SQL problems in VBA?!?!?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-16-03, 15:18
jfouse jfouse is offline
Registered User
 
Join Date: May 2003
Posts: 22
SQL problems in VBA?!?!?

here is my code and it works fine as is:

Set cn = CurrentProject.Connection
Set rst = New ADODB.Recordset

With rst
.PageSize = 8
.ActiveConnection = cn
.Source = "SELECT * From Development, developmentpictures"
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.Open

BUT!!!

this returns too much information and when I attempt to alter the SQL query such as below ...I get an error with ".OPEN" highlighted in VBA

Set cn = CurrentProject.Connection
Set rst = New ADODB.Recordset

With rst
.PageSize = 8
.ActiveConnection = cn
.Source = "SELECT * From Development, developmentpictures WHERE Development.Kinder Number = developmentpictures.Kin Num"
.LockType = adLockOptimistic
.CursorType = adOpenStatic
.Open


PLEASE HELP!!!!!!
Reply With Quote
  #2 (permalink)  
Old 05-16-03, 15:32
bc301 bc301 is offline
Registered User
 
Join Date: Dec 2002
Posts: 60
Try bracketing [Kinder Number] and [Kin Num] in the where statement, or re-naming w/o spaces.

As a general rule, spaces in field/object names only cause trouble.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On