Open Form Macro

  • Thread starter Tom K via AccessMonster.com
  • Start date
T

Tom K via AccessMonster.com

Hi,
Im tring to open a form(frmBusiness) from another form (frmAddress). Im using
a command button on the Address form which uses a macro action Open Form. The
data mode is left blank. The Where is set to [AddressID] = [Forms]!
[frmAddress]![AddressID]. The business form Edit and Add properties are set
to No because I dont want to add records or edit directly from the business
form. The problem is that if there is a record for the business it displays
that record, but if there is no record the whole form is displayed blank with
no controls. I want it to open to a new record if there is no current record.

If I set the data mode in the open form action to add or edit it works but it
then allows the user to add and edit records from the business form (it
overrides the forms properties, AllowEdits=No...ect) , which I dont want.

help

Tom
 
S

Steve Schapel

Tom,

I am fairly sure I understand what you mean. How about doing your macro
like this (assumes that the Record Source of the frmAddress form is a
query named Addresses)...

Condition: DCount("*","Addresses","[AddressID]=" & [AddressID])>0
Action: OpenForm
Form Name: frmAddress
Where Condition: [AddressID]=[Forms]![frmAddress]![AddressID]
Condition: DCount("*","Addresses","[AddressID]=" & [AddressID])=0
Action: OpenForm
Form Name: frmAddress
Condition: ...
Action: SetValue
Item: [Forms]![frmAddress].[AllowAdditions]
Expression: Yes
Condition: ...
Action: GoToRecord
Record: New
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top