A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access 2003 mouse down property code problem



 
 
Thread Tools Display Modes
  #1  
Old May 13th, 2009, 04:37 PM posted to microsoft.public.access.tablesdbdesign
Bob Waggoner[_2_]
external usenet poster
 
Posts: 80
Default Access 2003 mouse down property code problem

I have a combo box that I use to quickly find a record. I want the lookup
list name to disappear after use (not the combo box, just the name that was
selected), so I set the forecolor property to the backcolor property in the
after update property. (This works in Access 97.) When I try to restore the
forecolor property to 0 (black) if the user needs to change records using the
On Mouse Down event, the lookup no longer finds the record. Here's my code:

Private Sub Combo29_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LiAttendeesID] = " & Str(Nz(Me![Combo29], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me!Combo29.ForeColor = 16777164
End Sub

On Mouse Down property:

Private Sub Combo29_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me!Combo29.ForeColor = 0
End Sub

If I remove the On Mouse Down code, the look up works.

What do I need to do to fix this?
  #2  
Old May 13th, 2009, 04:59 PM posted to microsoft.public.access.tablesdbdesign
Maarkr
external usenet poster
 
Posts: 240
Default Access 2003 mouse down property code problem

why not just use Me!Combo29 = Null instead of Me!Combo29.ForeColor = 16777164
?


"Bob Waggoner" wrote:

I have a combo box that I use to quickly find a record. I want the lookup
list name to disappear after use (not the combo box, just the name that was
selected), so I set the forecolor property to the backcolor property in the
after update property. (This works in Access 97.) When I try to restore the
forecolor property to 0 (black) if the user needs to change records using the
On Mouse Down event, the lookup no longer finds the record. Here's my code:

Private Sub Combo29_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LiAttendeesID] = " & Str(Nz(Me![Combo29], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me!Combo29.ForeColor = 16777164
End Sub

On Mouse Down property:

Private Sub Combo29_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me!Combo29.ForeColor = 0
End Sub

If I remove the On Mouse Down code, the look up works.

What do I need to do to fix this?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.