Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Form from another form

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
US
Hi All, I know how to set it up to open a form from a button on another form and to either have it open to all records or a specific record. What I can't figure out is how to tell it to open to a NEW record. I have Access 2010 where it defaults to the macro when setting up a button. Thanks!!!

 
How are ya dawnd3 . . .

In the forms [blue]On Load[/blue] event try:
Code:
[blue]   If Not Me.NewRecord Then DoCmd.RunCommand acCmdRecordsGoToNew[/blue]
You could also set data entry to true ...

Your Thoughts? ...

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi AceMan, thanks! I am trying to set this up in the default macro that was created when I created the button. I have the button currently set to open the form to the record that matches the ID of the person who's record is the focus. So I think I need to set up an IF statement that if the ID is null open to a new record but if not open to the ID of current record. Does that make any sense?

Dawn

 
I am thinking I need to change the where condition on the open form properties. How do I tell it "new record" in the where condition spot?

 
dawnd3 . . .

Post the code! ...

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
There is no code. It is a macro. Not sure how to share the screenshot.

Dawn

 
dawnd3 . . .

Set the [blue]Data Mode[/blue] to [blue]Add[/blue] ...

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
under database tools, you can convert Macros to VB code when the form is in design view.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top