Table & Feild Refenece in VBA

N

Ndel40

What is the format for referencing a specific field in a table? I tried it
as written below (substituting my field and table names), but it does not
work (with or with out the quotes)... see below.

Do I need to somehow declare the table and fields?

Thanks,

Nick
 
H

Helgard

If I am correct in thinking what you want to do you will have to select the
record from the table and then do your comparison

Set dbs = OpenDatabase("C:\database.mdb")
QrySel = "Select fieldname from table As SpecificField where
whateverconditions"
Set RstSel = dbs.OpenRecordset(QrySel, dbOpenDynaset)
On Error GoTo Errorwhatever
RstSel.MoveFirst
( Here you can use the field for example:
If TbxName.Value = RstSel!SpecificField then
do condition
End If
RstSel.Close )
 

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