Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform not accessing next record unless I go into design view??!

Status
Not open for further replies.

MatthewP

Programmer
Jan 16, 2001
176
GB
I have a form that contains a subform, and when a product is selected in a combo box, it is supposed to appear in the subform, together with it's price and other info. This bit works fine for the first product I enter, but the go to next record bit in the macro is not working properly, and I am told I am at the end of a recordset.

I've tried 2 ways of doing this - after the record has been entered I use GoToControl with the name of the subform, and then GoToRecord Next (have also tried New). Each time I get the 'Cant go to specified record - May be at the end of a recordset' error message. The other way was just using GoToRecord with object type Form and the Form name - this way I get an error that the object 'my subform' isn't open.

BUT!! Stranger than that, if I flip the form into design view, and then back into form view, the form re-appears with a new line in the sub-form which I can put another record in, and I have to repeat this feature with each product I want to appear in the sub form.

Any ideas anyone?

Thanks in advance,
Matt.
 
Is the Combo box in the subform or in the parent?
 
Try using the requery method in your combobox's afterupdate

sub <name> afterupdate()
me.requery
end sub

The problem could be that your subform is based on a query in which you select the product from the dropdownbox.
(select productid from product where productid = combobox, or something)When you select a new product you have to let access run the query again so that it runs with the newly selected value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top