How can I fine a name in a table and compare it?
If the name is in the table, continue with FORWARD. Else, then write information to a different table.

Approver is a name in the record that is doing the work. I wanted to see if this person is authorized by looking at a list of names in tblFont.

Set Dbe = Application.CreateObject("DAO.DBEngine.36")

Set MyDB = Dbe.Workspaces(0).OpenDatabase" _
("J:\edgar\testcigars\newcigars3.mdb")
Set Rst = MyDB.OpenRecordset("select * from tblFont")
SearchText = name

If searchtext = Approver1 Then
Forward1
Else if searchtext <> Approver Then
UserProperties.Find("txtstatus").Value = "Finished"
UserProperties.Find("jobtype").Value = "Unauthorized User"
UserProperties.Find("Approver1").Value = vrUser
End If

Not sure if this is enough info. - MS Access XP, Using this script in MS Outlook form. This is run using a command button.

Recommended Answers

All 2 Replies

Set Rst = MyDB.OpenRecordset("select * from tblFont where fieldname=SearchText") <-- not sure if this is going to be an integer or string so format it properly.

Then do if row count > 0 do something else.

If I were you I would start changing everything from dao to ado for speed and upgradability.

dim conn as adodb.connection
dim rs as adodb.recordset

set conn = new adodb.connection
set rs = new adodb.recordset

conn.open {connectionstring}
mysql = "select name,pass from tblFont where name='" & reviver1 & "';"
rs.open Mysql,conn,3,3,1

if not rs.eof then
     do while not rs.eof
         compare blah, blah > blah
         rs.movenext
         loop
else
label1.caption="No Records Found."
end if
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.