Solved

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

816 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

12 Experts available now in Live!

Get 1:1 Help Now