开发者

Access form's Detail's event only triggers on first record

开发者 https://www.devze.com 2023-02-14 11:40 出处:网络
I\'m designing a Form in Access 2003.My goal is that when the user double-clicks on a record (aka Detail), a second form opens.This is easy enough to do when I start from scratch.

I'm designing a Form in Access 2003. My goal is that when the user double-clicks on a record (aka Detail), a second form opens. This is easy enough to do when I start from scratch.

But of course, I'm not starting from scratch. I've been working on this for a few hours now, have added some conditionally formatted textboxes, fields, etc, and don't want to start over if I can avoid it.

I don't know if I turned on/off some obscure property, but I've been working on this f开发者_StackOverflow中文版orm for a few hours now and the Double-Click event of the Details section only triggers when I double-click on the first record or any other with conditional formatting.

To troubleshoot this, I've gone so far as to comment out all the other VBA script except this:

Private Sub Form_Load()  
    Me.Application.DoCmd.Maximize 
End Sub

Sub GotoFrmDetails()  
    MsgBox "You Double Clicked Me!" 
End Sub

Even with the VBA script reduced to just these lines, the DoubleClick event only triggers on the first record and no other. Can anyone tell me what wrong? I'd rather not have to rebuild this from scratch.


I find the click events of form sections to be more trouble than they are worth (click event doesn't pass through to the form if user clicks on a control or label, etc). What I use instead are transparent command buttons.

Just add a command button to your form and set its Transparent property equal to True. Then you can use the Z-order to make fine-grain changes if necessary (send to front/back, send forward/back).

They can be hard to find once you make them transparent, so be sure to give them descriptive names.

If you want the user to be able to double click anywhere in the detail section, just make the transparent command button's height/width match the section height/width.

Move your code from the Detail section DoubleClick event to the transparent command button's DoubleClick event and you should be good to go.


I'm wondering if the rows are getting their Locked property set to Yes, or their Enabled property set to No during your condition formatting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号