Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Posts
    22

    Unanswered: 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!!!!!!

  2. #2
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •