Go to the specified form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
I have a form which only purpose is to show the result of a query (just some
form fields). This information is to be protected (read only); however I
would like to make a certain field active in order the user to double click
and to open the respective form.
I allready tried to do a macro and it works partially, because when I double
click in the 5th record (for example), it opens allways the record number 1
and I have to go to the specified one (number 5). How can I go directly to
the number 5?
Can anyone help me?
Thank you in advance.
 
Acores,
First, When a field is Enabled but Locked, the data can not be altered, but it will
react to the Double Click.

What you're doing is what I call a "Jump" field. A continous form displays records,
and when you click a certain field on any record, a form opens to display the details of
that record, and allow for editing of that "supporting" data.
I usually use color any jump field as dark red with white font so the user always
knows that that color, anywhere in the app, is a jump field.

Each record should have a unique key value, say for example CustomerID. It can be
hidden on your continuous form.
Use the Where argument in the OpenForm method to specify what record you want to Open
on.
On the Dbl-click of the something convenient like the CustomerName...

DoCmd.OpenForm "frmCustomers", , , "IDNo = Forms!frmYourListForm!Form!CustomerID"

Use your own object names and... my code assumes your "calling" CustomerID is on a Main
form, not a subform.
 
Hello, Al Camp.

First of all, thank you for your quick answer. However I tried to apply your
solution, but it didn´t worked.

Could you be more clear about it, please?

The real situation is: I have a continuous form, called
«frm_Lista_de_Obras», in which I want no double click in a certain field
«Obra_ref» and jump to the specific record in another form, called
«frm_Obras». They have both a auto number field (not visible) called
«Obra_ID» (primary key).

Another question is: what can I do to, once opened the required record, not
allow the user to go to the other records? I just want the user to open, edit
and close the form.

Thank you again, and sorry for all this questions.

Best regards.

Acores


"Al Camp" escreveu:
 
First of all, thank you for your quick answer. However I tried to apply your
solution, but it didn´t worked.

Please show me the exactly the code you used, and describe in detail where you entered
that code.
Also, what is the name of your main form, the name of your subform, and the name of the
form you want to open.

Your code should be in your Form Module within the field DoubleClick event.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
Hi, Al Camp.

Once again, thank you for your effort.

I have one main form when I enter all the information needed for each record
- this form name is «frm_Obras». I have a field on this form called «Obra_ID»
(not visible).

Then I created a new form where only the most important «Frm_Obras» fields
will be shown - it's a continuous form called «frm_Lista_de_Obras». I
included in this one the «Obra_ID» field also (not visible too).

My purpose is: the user begins to see the continuous form
«frm_Lista_de_Obras» and if he wants to edit a specific record, he just
double click in a certain field (in this case, the field «Obra_ref»), and
jumps to that (and only) specific record.

Yesterday, what I have done with your help was: I entered the following
procedure in the double click procedure in the field «Obra_ref», of the
«frm_Lista_de_Obras»:

Private Sub Obra_ref_DblClick(Cancel As Integer)
DoCmd.OpenForm "frm_Obras", , , "Obra_ID = forms!frm_Lista_de_Obras!Obra_ID"
End Sub

But when I double click in this field, just opens a empty record of the
«frm_Obras».

Have I done something wrong?

Thank you again for your help.

Regards.

Acores


"Al Camp" escreveu:
 
acores,
That's all good info...
It looks as though you've done everything right, so there must be some other problem
that we are unaware of.

I have a similar situation in one of my own apps. A subform with many names and phone
numbers, where I want to "jump" to the complete details for any name.
My Dbl-Click...
DoCmd.OpenForm "frmAddresses", , , "IDNo =
Forms!frmAddressBook!frmAddressBookSub.Form!IDNo"
This works. Only difference is that I "call" the jump from a subform.
Your code should work too...

Just as a test, try "un-hiding" the Obras_ID on frm_Lista_de_Obras and frm_Obras, so
that you can see it on each.
Make sure that the fields are Named EXACTLY that... Obras_ID
Name: Obras_ID
ControlSource: Obras_ID

If that doesn't work...

Why don't you just send me your database.
We've covered all the normal fixes, so from here on in we're just fumbling around.
Zip the mdb and send it through my web site below (under Contact). Please indicate
your Access version.
I'll try to turn it around ASAP.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
Back
Top