how to get table values into variable

E

ezil

The following codes are working perfectly

a=forms!forms1.field1
forms!forms1.field1=a

like this any code is there for getting values directly from table ?

i tried
a= tables!table1.field1
but it is not working
 
J

Jack Leach

Search the help for DLookup (or go to www.allenbrowne.com/tips.html and
import his ELookup function).

variable = DLookup("fieldname", "tablename", "where clause")

will return null if no values are found, so you may want to wrap with the
Nz() function:

variable = Nz(DLookup("fieldname", "tablename", "whereclause"), "")


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
E

ezil

variable = DLookup("fieldname", "tablename", "where clause")
this is the code for getting table value into variable
like that how to change table value to variable value
(i.e table1.field1=variable)
 
J

Jack Leach

CurrentDb.Execute _
"UPDATE tablename " & _
"SET fieldname=value " & _
"WHERE fieldname=value"

you're welcome

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 

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