OpenForm Macro to "New" Entry (1 Viewer)

tim1982

Registered User.
Local time
Today, 05:56
Joined
Feb 18, 2009
Messages
21
Hello,

I have a few openform buttons that I'd like to open on a "New" entry.... I've tried entering new in the where clause of the macro action, but it doesn't seem to be working like this...

Action Arguments
OpenForm Enter/Edit Orders, Form, , [OrderID]=[New], , Normal


Much obliged,

Tim
 

boblarson

Smeghead
Local time
Today, 05:56
Joined
Jan 12, 2001
Messages
32,059
No, you don't do it that way.

1. have a step that opens the form

2. have the next step in the macro do Go To Record and select NEW in the arguments under RECORD.

Also, you shouldn't name objects with special characters in them (/) like Enter/Edit and I would not include spaces in your names as that can be a pain.
 

tim1982

Registered User.
Local time
Today, 05:56
Joined
Feb 18, 2009
Messages
21
Bob,

Thanks for the quick response. I tried adding a "GoToRecord" action, but it gave me an "object not open" message...

OpenForm----- Enter/Edit Orders, Form, , , , Dialog
GoToRecord--- Form, Enter/Edit Orders, New,

Any further help appreciated... I'll also think about changing my Form name with a "/" in it. Thanks.

Tim
 

tim1982

Registered User.
Local time
Today, 05:56
Joined
Feb 18, 2009
Messages
21
OK, I've noticed that if I have the form open already, the "GoToRecord" will go to a new entry...

However, I wanted to have it open in a dialog box opened individually each time so you can only see one record at a time.... with this setting, it won't go to the new record and says "object form not open"

Tim
 

boblarson

Smeghead
Local time
Today, 05:56
Joined
Jan 12, 2001
Messages
32,059
Then just in the form open macro part change the DATA MODE argument to ADD.
 

tim1982

Registered User.
Local time
Today, 05:56
Joined
Feb 18, 2009
Messages
21
OK, it opens to a new record just perfect... However, when I close the dialog box, it still comes up with an error that the object/form isn't open...

It's redundant, since I can open a new entry, but is there something I did wrong to make this error to still appear?

The errors (there are two) that appear are as follows:

1)

The object 'Enter/Edit Orders' isn't open

*The macro you are running (directly or indirectly) contains a GoToRecord, RepaintObject, or SelectObject, but the Object Name argument names an object that is closed.
*The objectname argument for the GoToRecord, RepaintObject, or SelectObject method names an object that is closed

Use one of the Open actions or methods to open the object so that you can carry out the desired action.

2)

ACTION FAILED

Macro Name:
ScanACOrdersSubReport : Command 20: OnClck : Embedded Macro

Condition:
True

Action Name:
GoToRecord

Arguments:
2, Enter/Edit Orders, New

Error Number:
2950




 

boblarson

Smeghead
Local time
Today, 05:56
Joined
Jan 12, 2001
Messages
32,059
Did you get rid of the line that we had added for the Go To Record? If you are opening the form in ADD mode then you don't need that macro line.
 

tim1982

Registered User.
Local time
Today, 05:56
Joined
Feb 18, 2009
Messages
21
Ahh! That makes sense. I just assumed I had to keep adding, not subtract.

Thanks, Bob.


I guess my only little concern now is that the report doesn't reload the data I've just inputted... Is there a way to have a "refresh" button on the report. Beyond that, is it possible to have the macro automatically refresh the report as it closes down the form it's just been updated with?

Just throwing it out there. I think I might try the "requery" macro, but I'm not exactly sure what that does yet.

Tim
 
Last edited:

boblarson

Smeghead
Local time
Today, 05:56
Joined
Jan 12, 2001
Messages
32,059
Add a DoCmd.RunCommand acCmdSaveRecord to the code that launches the report so that the current record is saved. If using a macro then it would be Action RunCommand and command would be SaveRecord.
 

tim1982

Registered User.
Local time
Today, 05:56
Joined
Feb 18, 2009
Messages
21
Hi Bob,

I tried what you recommended, but it gave me a few errors.

However, I did figure a way around this problem by simply closing the report when I open the edit form, then re-opening it once I close the edit form.... this way, it re-opens after I've made my changes, and of course the edits are already in my report again.

So for now... problem solved.... I think you've helped me solve more like 4 problems. Thanks, Bob.

-- Tim
 

Users who are viewing this thread

Top Bottom