+ Reply to Thread
Results 1 to 3 of 3

check double records in database

  1. #1
    tinybears
    Guest

    check double records in database

    Hey,

    I'm looking for a code to know if a row with primarty key ticker is
    already in my table DDM.
    I use the following code but there seem som problems. It says the
    variable TextTicker.Text is not defined. Can someone help me out? Thx

    s_Path = ActiveWorkbook.Path
    s_Path = s_Path & "\Thesis.mdb"

    Set DB = DAO.OpenDatabase(s_Path)

    s_SQL = "SELECT Ticker & FROM DDM " _
    & "WHERE Ticker = ' & Me.TextTicker & " ';"


    If s_SQL = TextTicker.Text Then

    MsgBox "Found"

    Else

    MsgBox "Not found"
    GoTo execute_code:


    End If

    Set rs = Nothing
    Set DB = Nothing

    execute_code:


  2. #2
    Puppet_Sock
    Guest

    Re: check double records in database

    tinybears wrote:
    > I'm looking for a code to know if a row with primarty key ticker is
    > already in my table DDM.
    > I use the following code but there seem som problems. It says the
    > variable TextTicker.Text is not defined. Can someone help me out? Thx
    >
    > s_Path = ActiveWorkbook.Path
    > s_Path = s_Path & "\Thesis.mdb"
    >
    > Set DB = DAO.OpenDatabase(s_Path)
    >
    > s_SQL = "SELECT Ticker & FROM DDM " _
    > & "WHERE Ticker = ' & Me.TextTicker & " ';"
    >
    >
    > If s_SQL = TextTicker.Text Then
    >
    > MsgBox "Found"
    >
    > Else
    >
    > MsgBox "Not found"
    > GoTo execute_code:
    >
    >
    > End If
    >
    > Set rs = Nothing
    > Set DB = Nothing
    >
    > execute_code:


    Ok, I'm looking, and I don't see anywhere that TextTicker is defined,
    except possibly as part of "Me" which itself is not defined. So, what
    if you put Me.TextTicker instead of TextTicker? Is Me defined?

    Also, the line

    > If s_SQL = TextTicker.Text Then


    looks pretty weird. It looks like s_SQL is supposed to be a SQL
    command, so presumably there's a database around someplace.
    Why do you expect TextTicker.Text to be equal to this command?

    The rest looks pretty weird also. If the equality is true, then you
    set rs and DB to Nothing. But if it is not true, you don't. What's up
    with that? And what is rs?

    Also, if it is a SQL command, are you planning to execute it?

    I think you need a book to read about this stuff. You seem to have
    plenty of problems.
    Socks


  3. #3
    tinybears
    Guest

    Re: check double records in database

    That's why I'm freaking out about it. I need to hand it in next week. O
    well ...

    thx for your honest reply


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1