Solved

Macro to open form, find record and open another form based on record found

Posted on 2008-09-29
5
318 Views
Last Modified: 2013-11-28
Hi everyone,
I have a main menu form "frmMainMenu"  that has a combo box "cmbPeople" on it that list the people and users select a person, then hit "Go" and the main form "FrmMain" opens and the rest of the information can be entered.
Now I want the users to be able to add a new person quickly - like add their name and bdate, then click "Continue" and navigate to the frmMainMenu, find the newly added person in the conbobox and then open frmMain with that information and then close the new form "frmAddNew", (it has a couple of fields, I also have a continue button on it. It is set to only allow data entry (Data Entry = yes). )

How can I do this?  Should I try and use a macro?

Thanks in advance!!!
Jetera
0
Comment
Question by:jetera
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:dprager
ID: 22596714
below some code you can paste behind the eventprocedure of the button to click
where the table is ofcourse the table where you linked your listbox to.

dim Dbs as DAO.recordset
set rst = currentdb.openrecordset("table")
rst.add
rst!name = [texbox1]
rst!birthdate = [texbox2]
rst.edit
rst.update
rst.close

docmd.openform "rmMainMenu"

Good luck !!
0
 

Author Comment

by:jetera
ID: 22623788
This doesn't really work, when I open  "frmMainMenu"  that has a combo box "cmbPeople" on it I want to have it showing the name I just entered so that the user doesn't have to scroll through the list.  I was thinking of findrecord or gotto control - that's why i thought I should use a macro... can we change your code to do that?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 22643778
jetera,

Try this:

JeffCoachman
Access-EEQ23771274AddNewEmployee.mdb
0
 

Author Closing Comment

by:jetera
ID: 31501178
Thanks - it works great!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22675415
;-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question