Button to open record details on continuous form with summaries

  • Thread starter Thread starter Sietske
  • Start date Start date
S

Sietske

I've a continous form which shows a list of all records (to be precise, it
shows the results of a search query). In this list, a brief summary of each
record is shown. To view details of each record, I have put a button "view
details..." on the right side of each record which opens a form showing the
entire record.

My problem is: each "view details..." button has to be clicked twice to open
the record. Once for selecting it, and once more to open it. How do I change
this so that one click is enough?

A possible solution is changing the buttons on the right of the record in a
"select record" button, and put one button in the header of the screen,
saying "open selected record". But I'd rather stick to the button I have. Is
there an option like "OnMouseOver" or anything else I could use?
 
What exactly do you mean by selecting it? You should have to click te button
once to open the form and view the details. Did you use a toggle button
perhaps?
 
With "selecting" I mean that the focus is on an item in the record.
Literally: that you can see the Record Selector on the left pointing at the
specific record that you want to watch in more detail. If that is the case, I
can click the button of the specific record only once. Otherwise I have to
click twice.

It is not a toggle button.
 
Ok, as I read it your record state is "Dirty" is that what you mean? In that
case you can set me.dirty=false in the on click just before you open the form.

hth
 
No, as far as my Access-knowledge goes, the record is not dirty: The
continuous form shows "search results", and gives a summary of the records
which are found. These summaries are not editable.

The problem is that when the "show details..."-button behind a specific
record is pushed for the first time, the button does not function as a
button, but just as a part of the record: you can click anywhere in the
record to select it: on the button, but also on the text in the summary. Only
when the record is already selected, the button functions as a button.
 
Hmm, that's weird. Sorry to say that but you wrote that you have a continuous
form with a button on it. When I have a continuous form with a button on it,
it behaves just the way you would expect it. This doesn't help you much I
know but i'm just trying to figure out what can be possibly different in what
i'mdoing here. So let me try to recap:

you have a continuous form with textboxes on it for your recordset right. I
presume a Excel like layout with rows and at the end of the row you have the
button which takes you to the detailsform right?

Just for the sake of it try adding another button next to it using the
wizard which just opens an arbitrary form. If this opens with just one click
replace the code from this button with the code from your button.
 
Hi Maurice, I just wanted to inform you that I succeeded in making the button
work.
It is probably not the most "correct" solution, but it works.

To solve the problem of the details button, I replaced the event "On Click"
by the event "On Focus". When the focus is on the button (which automatically
happens when the button is clicked once), the event takes place and the
record is opened.

However, thank you for your time to help me! A problem becomes already half
as bad when there is someone who cares about it too :-)

Best regards,
Sietske
 
Sietske,

What is the command you used off your "View Details" button. I'm trying to
do the same thing, and my "view details" button is just not working!
 
Hi Skot,

I'm sorry for my late response, didn't spot your question until now. I hope
it helps a bit, still. Please let me know If you succeeded, so that others
can benefit from your findings too.

What I did, was the following: On the View Details-button I did NOT use an
OnClick event, but only a GotFocus event. It looks like this:

Private Sub btnViewDetails_GotFocus()
On Error GoTo Err_btnViewDetails_GotFocus

Dim strDocName As String
Dim strWhere As String

strDocName = "frmNameOfFormWithDetails"
strWhere = "[Id_FormWithDetails]=" & Me!Id_FormWithDetails
DoCmd.OpenForm strDocName, , , strWhere
Me.NameOfAnyControlOutsideDetailsSectionOfForm.SetFocus

Exit_btnViewDetails_GotFocus:
Exit Sub

Err_btnViewDetails_GotFocus:
MsgBox "Error code " & Err.Number & ": " & Err.Description
Resume Exit_btnViewDetails_GotFocus
End Sub
 
One possible cause is if you have an OnCurrent event that sets the focus to a control, you end up having to push your button twice. When you push your button the first time, the OnCurrent event sets the focus away from the button. So then you have to push it again. Remove the SetFocus method from your OnCurrent event and your button should work properly.

The reply is late, but hopefully will help.
 
Back
Top