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

Find Button on Form

Status
Not open for further replies.

Gerilee

Programmer
Mar 23, 2001
47
US
I am new to this but am struggling along. I have 2 questions. I use a Main Menu form instead of a switchboard to navigate through my database. The Main Menu from has a button to go to another form for database maintenance. The Database Maintenance form has command buttons for Find, Add, Delete, Next and Previous Records. It also has 2 other buttons. One that goes to a form to run reports and a button to return to the Main Menu form. I don't like the automatic updates of records feature of Access so I am trying to use properties and VBA to make it work in a more friendly way for the users (who are not computer literate). Instead of the automatic update, I want them to click a SAVE button to update and if they don't do that, the record won't be saved. In the Close property of the form, I use Me.Dirty and Me.Undo to take care of this. Is this the best way to do that? Also, I am looking for some good code for the Find button. I want the user to be able to put a value in one or more fields in the form, click Find, and for it to return 10 records found (or whatever). I know the Filter button on the tool bar will do this but I am trying to give them a command button to use. I don't have an Edit button on the form. That's why I wanted the find button -- for the user to find a record by their criteria and THEN edit the found record. Is it okay to Edit and Add from the same form? The button on the Main Form opens the Database Maintenance form but I don't distinguish whether it should be open in edit mode or not -- it just opens it. Sorry for so many questions but the more I learn, the more I have. Thanks!
 
I am new to this but am struggling along. I have 2 questions.
2 ????

I don't like the automatic updates of records feature of Access so I am trying to use properties and VBA to make it work in a more friendly way for the users (who are not computer literate). Instead of the automatic update, I want them to click a SAVE button to update and if they don't do that, the record won't be saved. In the Close property of the form, I use Me.Dirty and Me.Undo to take care of this. Is this the best way to do that?

yes. I do that and it works fine.
disable the save and unfo buttons until something is changed or added.

I am looking for some good code for the Find button. I want the user to be able to put a value in one or more fields in the form, click Find, and for it to return 10 records found (or whatever). I know the Filter button on the tool bar will do this but I am trying to give them a command button to use. I don't have an Edit button on the form. That's why I wanted the find button -- for the user to find a record by their criteria and THEN edit the found record. Is it okay to Edit and Add from the same form?

You need to make a query which takes the values from textboxes on the form. put
= [forms]![nameofform].[nameoftextbox]
in the criteria of the fields you are searching on.


The button on the Main Form opens the Database Maintenance form but I don't distinguish whether it should be open in edit mode or not -- it just opens it.

you have to make a decision here...

Ian Mayor (UK)
Program Error
There's ALWAYS more than one way to skin a cat!
But only one way to get it RIGHT!
 
Okay, so I had 3 questions. I'm learning. Can you clarify how I would implement your suggestion with the Find button? I need more details as I'm on my own learning this. I can manage the query but need to know how to bind it to the control. I am mostly using VBA in the On Click properties of the controls. How do I execute a query from VBA code?

As far as the question about opening a form in edit mode -- the form is opened when the user clicks a button and the form can be used to read the records or edit them. So how do I decide? Does it matter? I'm just using DoCmd.Open Form in the On Click property of the button that opens the form. I can query and edit using the form but are there any ramifications of not opening the form in edit mode?

Any other help out there? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top