Access fields in table without using Recordsets

J

John H W

In Access 2000, I need to check a field (primary key) in a table for a
particular value. If the value is not there, I wish to use that value.

I cannot use ADO, DAO, or Recordsets (Our state has removed that capability
in the office level). Is there anyway to do this without running a query for
every variable?

Thanks,
John H W
 
J

John Vinson

In Access 2000, I need to check a field (primary key) in a table for a
particular value. If the value is not there, I wish to use that value.

I cannot use ADO, DAO, or Recordsets (Our state has removed that capability
in the office level). Is there anyway to do this without running a query for
every variable?

Yes; DLookUp.

E.g.

If IsNull(DLookUp("[field]", "
", "[field] = " & variable) Then


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
E

Eric Schittlipz

John H W said:
In Access 2000, I need to check a field (primary key) in a table for a
particular value. If the value is not there, I wish to use that value.

I cannot use ADO, DAO, or Recordsets (Our state has removed that capability
in the office level). Is there anyway to do this without running a query for
every variable?

Thanks,
John H W


Are you sure? How have they done that? What happens if you have
Me.RecordsetClone within a form? Does that not return a DAO recordset?
Anyway, if you need to check for a value you could use:

DCOUNT("ConID","tblContacts","[ConID]=5")

Which should return 1 if there is a contact with an ID of 5, or 0 if there
is no matching entries.
 
J

John H W

Eric Schittlipz said:
Are you sure? How have they done that? What happens if you have
Me.RecordsetClone within a form? Does that not return a DAO recordset?
Anyway, if you need to check for a value you could use:
I don't know how, but even though there are entries (in search) for
Recordset, DAO and ADO in the help file, when you click on the "find" nothing
happens. When I try to use any of these, Access VBS gives a "not defined"
error.

Thanks for the info.

John H W
 
J

John Vinson

I don't know how, but even though there are entries (in search) for
Recordset, DAO and ADO in the help file, when you click on the "find" nothing
happens. When I try to use any of these, Access VBS gives a "not defined"
error.

The Access Help system has been munged since 2000. Try typing Ctrl-G
to get into the VBA editor; select Tools... References. Is Microsft
DAO x.xx Object Library selected? If not, try selecting it.

Also you'll have a different Help library - with more (though still
badly indexed and hard to search) info about recordsets when you have
the VBA editor window open.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top