Results 1 to 2 of 2

Thread: Data.recordsource sql is empty

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Littlehampton, W Sussex GB
    Posts
    203

    Post

    Can anyone tell me the best way to check via an sql if a record exists on my database and to create it if it doesnt? I do
    datax.recordsource = sql but then when I test for EOF or Refresh I get an error if its not there ? Help! If its not there I need to create a new record - thanks

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    Try it,

    Data1.DatabaseName = "d:\db1.mdb"
    Data1.RecordSource = "SELECT * FROM table1 WHERE id=3"
    Data1.Refresh

    if Data1.Recordset.RecordCount=0 then
    ...
    else
    ...
    endif

    ------------------
    smalig
    [email protected]
    smalig.tripod.com

Posting Permissions

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



Click Here to Expand Forum to Full Width