View Full Version : Visual Basic
rakshu4ever
Dec 4, 2006, 03:37 AM
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.
gillskad
Dec 22, 2006, 10:28 AM
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.
admiralsfan
Jan 9, 2007, 10:04 PM
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
GaryStaunton
Jan 20, 2011, 10:35 PM
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