jetera
asked on
Macro to open form, find record and open another form based on record found
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
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
ASKER
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks - it works great!
;-)
where the table is ofcourse the table where you linked your listbox to.
dim Dbs as DAO.recordset
set rst = currentdb.openrecordset("t
rst.add
rst!name = [texbox1]
rst!birthdate = [texbox2]
rst.edit
rst.update
rst.close
docmd.openform "rmMainMenu"
Good luck !!