Solved

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

Posted on 2008-09-29
5
315 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now