Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

760 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

20 Experts available now in Live!

Get 1:1 Help Now