Hi :) how do You Find if there is a record with the ID field that = 1
Pleas Help Thanks :cool:
Printable View
Hi :) how do You Find if there is a record with the ID field that = 1
Pleas Help Thanks :cool:
It depends on what you are using to connect to the database.
I'll give you an example of what I use to play with databases.
dim dbsData as database, rcdTable as recordset, lngIDnum as long
lngIDnum = "123456"
set dbsData = OpenDatabase("mydata.mdb")
'this is the name of what ever database you connect to
set rcdTable = dbsData.OpenRecordset("Select * from table where IDfield = " & lngIDnum)
'using a variable to show how it would work
'if you don't want to - ("Select * from table where IDfield = 123456")
if rcdTable.eof then
'this record ID was not found
else
'record found
msgbox "Found record.", vbokonly, "Found"
end if
rcdTable.close
dbsData.close
This would check for a record with id of 123456 in field IDfield, in table Table from database mydata.mdb
Hope this helps.
Thanks a ton :) :) :) :) :) :) :) :)