Resetting the filter when going from one form to another

D

Design by Sue

I have a "add new form" for the user to add new part numbers to the database.
If the number entered in the part number field matches one already in the
database, a message box pops up giving them the choice to edit the existing
number. Clicking yes returns the user to the "edit form" where they can then
make changes to the existing information. This all works EXCEPT I am using
the Do.Cmd OpenForm with the criteria of the part number of the "edit form"
being the same as the part number of the "add new form" This sets the filter
on the "edit" form to the the part number. This locks up the "edit" form as
the focus is now on the part number in the filter field and the user cannot
go to any of the other records. I have tried using Me.Filter = False in a
number of events, but it either immediately removes the filter leaving a
blank form or in combination with DoCmd.ShowAllRecords takes the user to the
first record in the database. (I was thinking that since I have all
navigation on the form through buttons that I have created, I could change
the code for the first record - which works this way, next record, last
record and previous record buttons - but this makes them all act like the
first record button.)

Hope this makes sense so someone can help.

Thanks
Sue
 
D

Design by Sue

Solved it. This can't (easily) be done using the method I stated before.
Instead I did the following:

PartNumberTemp = Me.PartNumber
DoCmd.OpenForm "InputFrm"
DoCmd.GoToControl "PartNumber"
DoCmd.FindRecord PartNumberTemp

What this is doing is saving the PartNumber from the Add New Form to a
module (PartNumberTemp) then opening the other form and going to the record
that matches the PartNumber Temp.

I post this in hopes it will help someone else who is having the same problem.

Sue
 

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