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

Main/Subform filter problem

Status
Not open for further replies.

AccessDevJunior

Programmer
Apr 14, 2004
81
GB
hya,

i have a main form with a subform, the main form recordsource is from 'tblReferenceNumber' and the subform recordsource is from 'tblCallRecord' the two tables have a one to many relationship.
i want an unbound text box on my main form where the user enter's the reference number then clicks 'commandbutton' which searches for that reference number and opens up the record
Else
if the record is not found then add new record.
(after searching and successfully finding a record i wish the subform to be able to updated).

i am having trouble writing the code for the command button. i have been experimenting with 'filter' and 'dlookup' but had no look. if anyone could help me in designing the best way to do this it would be a great help?
 
it may be best to use the filter property within the form, this way if it can not find anything, then it would prompt the user to enter a new record.

In reference to your sub-form not refreshing, its may be best to add some code into the on_current procedure in your main form, to refresh/requery the sub form.

I hope this helps. If you do need help with the coding side let me know...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top