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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding new main record from subform

Status
Not open for further replies.
Jan 14, 2002
143
US
Hello everybody, I am trying to let my users begin entering data in the subform before "officially" making a new record in the main form. Of course they will get an ugly message something to the effect "you cannot add or change a record becuase a related record is needed in tblBlahBlaBlah," if the master field from the main menu does not already have a value for the child field in the subform to relate with.

I figured out a way to add a record to the main form from the subform, but it still comes up with that same message-- even with the related ID in both forms. I tested the problem and apparently the main form's recordset needs refreshed before the subform will actually read the main form's ID. Me.parent!refresh doesn't do the job....so what does, anybody?

Thanks in advance
 
Have you tried the ShowallRecorcs action.

ShowAllRecords Action:

You can use the ShowAllRecords action to remove any applied filter from the active table, query result set, or form, and display all records in the table or result set or all records in the form's underlying table or query.

Setting

The ShowAllRecords action doesn't have any arguments.

Remarks

You can use this action to ensure that all records (including any changed or new records) are displayed for a table, query result set, or form. This action causes a requery of the records for a form or subform.

You can also use this action to remove any filter that was applied with the ApplyFilter action, the Apply Filter/Sort command on the Records menu, or the Filter Name or Where Condition argument of the OpenForm action.

This action has the same effect as clicking Remove Filter/Sort on the Records menu or clicking Remove Filter on the toolbar in Form view or Datasheet view.

To run the ShowAllRecords action in Visual Basic, use the ShowAllRecords method of the DoCmd object
 
Hey, how bout that, it worked! My first glance at the help file made me think it would show all the records in the table, which would be bad, but it kept the filter so I'm happy.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top