Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Visual Basic (https://www.askmehelpdesk.com/forumdisplay.php?f=469)
-   -   Visual Basic (https://www.askmehelpdesk.com/showthread.php?t=46498)

  • Dec 4, 2006, 03:37 AM
    rakshu4ever
    Visual Basic
    hi, I am using Access as my DB. I want to save a value in one table in DB. But the value am saving shd exists in database in another table. i.e. that value hs to be compared with the other table .Only if it exists then it has to be saved. How to do it.
  • Dec 22, 2006, 10:28 AM
    gillskad
    Quote:

    Originally Posted by rakshu4ever
    hi, I am using Access as my DB. I want to save a value in one table in DB. But the value am saving shd exists in database in another table. ie that value hs to be compared with the other table .Only if it exists then it has to be saved. How to do it.

    What kind of table you are making. And how you are relating them with each other.
  • Jan 9, 2007, 10:04 PM
    admiralsfan
    Quote:

    Originally Posted by rakshu4ever
    hi, I am using Access as my DB. I want to save a value in one table in DB. But the value am saving shd exists in database in another table. ie that value hs to be compared with the other table .Only if it exists then it has to be saved. How to do it.

    Sounds like a JOIN with a same primary key or foreign key in both tables
  • Jan 20, 2011, 10:35 PM
    GaryStaunton
    Wouldn't you need to search the second table for the value, if it exists, then save it to the first table?

    Eg query:

    SELECT * FROM TableValues WHERE FieldName = 'FindThisValue'

    So...

    Data1.RecordSource = strQRY

    If Data1.Recordset.RecordCount = 0 Then

    '// Doesn't exist so don't save it

    Else

    '// It exists in the values table, so we can now save it

    End If

  • All times are GMT -7. The time now is 12:42 AM.