UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Docmd.searchforrecord Detours To Current Event, Access 2010    
 
   
Verbalist
post Feb 24 2017, 03:07 PM
Post#1



Posts: 8
Joined: 24-July 14



Hi All,

I have a form with a header with two combo boxes. These combo boxes allow the user to search for a "Case" using either the CaseID which is a number, or a CaseCode which is a short string.
When the user changes one of the combo boxes. The program should 1) find that record and make it the current record, and 2) change the content of the other combo box so they are both referring to the same Case.

The result from the code I am using seems to be okay, but in tracing through it, I find that after executing line 1, control passes to the On_Current event of the subform, and then the On_Current event of the form before returning to line2. But it seems like not every change provokes this detour. Can someone tell me what is going on?

CODE
1.   DoCmd.SearchForRecord acDataForm, Me.Name, acFirst, "CaseCode = " & "'" & [cboCaseCodeSelector] & "'"

2.   cboCaseNumSelector = CaseID


Thanks, Michael.
Go to the top of the page
 
mklein
post Feb 24 2017, 04:30 PM
Post#2



Posts: 255
Joined: 7-August 12
From: BC, Canada


In a bound form the Current event fires when the form loads a new record, so any record navigation should fire a current event. Also, the Current event may not fire after your line 1 if the selected CaseCode is not found, or if the selected CaseCode is already current.

--------------------
| Mark Klein | Access 2010 | Windows 10 | Visual Studio 2013
Go to the top of the page
 
Verbalist
post Feb 28 2017, 02:42 AM
Post#3



Posts: 8
Joined: 24-July 14



Thank you. That explains a lot.

MMS.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    21st October 2017 - 09:44 PM