Accessing table and/or form fields from VBA

S

Steve Marsden

Can anyone help with a beginners question.

How do you get at a specific field in the current record of a table and/or
the value of a field in a form in VBA. How do you do this if the form you
want the info from is not the current form.

My specific problem is I have a table with a form. I have a button on that
form which runs another form. In the VBA code for this form I want to get
access to either a specific field in the record currently displayed on the
main form or if not possible the data in the equivalent field on the main
form.

My main form is called customers on a customer table. My second form is
called products on a products table. I want VBA code linked to the products
form to be able to get at the data store din the current record of the
customer table or form.

If I try using customer.ID I get an error Object Required
 
C

Cheryl Fischer

Hello Steve,

Forms!Customers!CustomerName

will get you the value of the CustomerName control on your form, Customers.


hth,
 

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

Similar Threads


Top