Simple Condition Question

C

cINDI

I need to create a macro that when in a form, if you
double click the field and the field is blank then it
opens up a related form in "Add New Record" mode. If the
field is not blank, when I double click, I want it to
open the form to to current record.

Example. I have a field that contains employee names.
If I double click on the name field and itis blank, then
open the Employee_HR form and allow me to add a new
employee. If it already has Jane Doe in the field, open
the Employee_HR form with Jane Doe's record on display.

I know it is simple, but I can't figure it out.

Thanks in advance!
 
K

Ken Snell

MacroToOpenForm:
Condition: Len(ScreenActiveControl.Value & "") = 0
Action: OpenForm
 
G

Guest

Ken,

Not sure what your response means. Here is what I was
trying...

Condition Action Properties
isnull([EmployeeName]) Open Form Edit Mode
not isnull(EmployeeName])Open Form
.... FindRecord

What we cant figure out is what to put in the Find What
box. We want it to open to current record.
 
J

Jim/Chris

Why not add a combo box which looks up existing employees
and goes to the employees record that is selected. Add a
button to go to addrecord on the form if the employee is
not on the list. Or you put goto addrecord on the not in
list event of the combo box.

Jim
-----Original Message-----
Ken,

Not sure what your response means. Here is what I was
trying...

Condition Action Properties
isnull([EmployeeName]) Open Form Edit Mode
not isnull(EmployeeName])Open Form
.... FindRecord

What we cant figure out is what to put in the Find What
box. We want it to open to current record.

-----Original Message-----
MacroToOpenForm:
Condition: Len(ScreenActiveControl.Value & "") = 0
Action: OpenForm

--

Ken Snell
<MS ACCESS MVP>




.
.
 
K

Ken Snell

I concur with Jim's suggestion. What you want to do is better accomplished
by having a form open, select the person, and then have the form display the
associated record. This is a result of the fact that you're opening the same
form whether the control has a value or doesn't.

The combo box should be put in the form's header. Use a query as the combo
box's Row Source, and the query should have a criterion expression for the
field that is being selected in the combo box similar to this:
Forms!Formname!ComboBoxName


--

Ken Snell
<MS ACCESS MVP>

Jim/Chris said:
Why not add a combo box which looks up existing employees
and goes to the employees record that is selected. Add a
button to go to addrecord on the form if the employee is
not on the list. Or you put goto addrecord on the not in
list event of the combo box.

Jim
-----Original Message-----
Ken,

Not sure what your response means. Here is what I was
trying...

Condition Action Properties
isnull([EmployeeName]) Open Form Edit Mode
not isnull(EmployeeName])Open Form
.... FindRecord

What we cant figure out is what to put in the Find What
box. We want it to open to current record.

-----Original Message-----
MacroToOpenForm:
Condition: Len(ScreenActiveControl.Value & "") = 0
Action: OpenForm

--

Ken Snell
<MS ACCESS MVP>

I need to create a macro that when in a form, if you
double click the field and the field is blank then it
opens up a related form in "Add New Record" mode. If the
field is not blank, when I double click, I want it to
open the form to to current record.

Example. I have a field that contains employee names.
If I double click on the name field and itis blank, then
open the Employee_HR form and allow me to add a new
employee. If it already has Jane Doe in the field, open
the Employee_HR form with Jane Doe's record on display.

I know it is simple, but I can't figure it out.

Thanks in advance!


.
.
 

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