adp only returning first record of subform


G

Guest

Hi,

I have an adp file used as a front end to SQL server. I have a form that
contains delete, edit buttons and a subform (datasheet view). When I click
on the edit or delete buttons they call VBA code that should retrieve the
currently selected record field from the subform.

var = Form_Subform.Field

After I have switched back from design view the above code will return the
field for the currently selected record but if I opened the form for the
first time it allways returns the field value for the first record in the
subfom.

Any idea why this happens and any way I can ensure I always return the
currently selected record?

I did try switching the subform to a continues form view and putting a
button on the subform that ran the code below. That returned the currently
selected record everytime, even though the button on the main form still
returned the first record on the form.

msgbox(Form_Subform.Field)
 
Ad

Advertisements


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