Open form to a specific record

C

CJ-Hewitt

I have two forms that I am working with

One called Edit Equipment and a second called MC Equip List.

The first form is a general view of a piece of heavy equipment which houses
a subform displaying all the equipment attached to it (based off of MC Equip
list)

In the subform, I have it displaying it as follows...

EQ Type --- Description --- Control Button

EQ Type --- Description --- Control Button

EQ Type --- Description --- Control Button

For each piece of equipment that is attached to the machine. The hope was
to click this button, open the MC Equip List form and jump to the record for
a more detailed look at the attached equipment, and eventually
order/repair/replace that item.

I used the control button wizard and matched the two fields that were
supposed to match,
"[Eq Type]=" & "'" & [EType] & "'"
however when I click this button a pop-up asks me to enter a parameter value.

What am I doing wrong?
 
A

Albert D. Kallal

I used the control button wizard and matched the two fields that were
supposed to match,
"[Eq Type]=" & "'" & [EType] & "'"
however when I click this button a pop-up asks me to enter a parameter
value.

Place the follwoign code behind the buttion:

docmd.Openform "MC Equip List form",,,"id = " & me!id

Now, replace "id" with the name of the primary key field used for that
sub-form table. It is possible that primary key field is EType, but are you
sure?

If yes, then go:

docmd.Openform "MC Equip List form",,,"Etype = " & me!Etype

If Etype is a string type field (text type), then you have to place quotes
around the field like:

docmd.Openform "MC Equip List form",,,"Etype = '" & me!Etype & "'"

One more thing. if you allow editing in this sub-form, then you really
should write any edits to disk BEFORE you launch the one details form.

So, before the above openform command, go:

if me.Dirty = true then
me.Dirty = false
end if
 

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