Access Vba Find Value In Table. When you call the GetFirstPrice function with a valid existing combination of OrderID and ProductID field values the function returns the unit price from the found record. Set dbs CurrentDb dbsExecute Update table set columnA valueA columnB ValueB Where ColumnC ValueC If dbsRecordsAffected 0 Then dbsExecute INSERT INTO table columnA columnB columnC VALUES valueA ValueB ValueC Else End IF.
However if you simply want to know if a record exists in a table you could also use either the DLookup or DCount function. _ tblListRowsFoundCellRow - tblHeaderRowRangeRowIndex Else MsgBox Value not found End If End Sub. DoCmdRunSQL DELETE FROM Table1.
Dim rst As DAORecordset Set rst CurrentdbOpenRecordsetSELECT FROM YourTable strSiteID.
These methods set the value of the NoMatch property to True if the specified value is not found. Return Table Row number if value is found If Not FoundCell Is Nothing Then MsgBox Found in table row. DLookupProductName Products ProductID FormsOrder DetailsProductID. DoCmdRename Table1 acTable Table1_New Another option is using the TableDefs property of a database object.