Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Synchronizing Navigation buttons w/ combo box

Status
Not open for further replies.

marct

Programmer
Apr 6, 1999
32
0
0
US
Hi,<br>
<br>
I have a form that displays a certain table's records by &quot;document number&quot;. The records are selected using a combo box that contains all the current document numbers. This works fine, but when records are selected with the navigation buttons, the document number does not update in the combo box, so the document number is now out of sync with the displayed document.<br>
<br>
I have tried updating the combo box with the new document number using the AfterUpdate event of the form, but that doesn't seem to work. Does anyone have any ideas? What am I doing wrong, or how should I be doing this? I'm kind of stumped here.<br>
<br>
Thanks in advance for any help that might be provided.<br>
<br>
-Marc
 
You need to &quot;sync&quot; the two together<br>
<br>
this code will work if you wan to sync the Form to the combo box<br>
-------------------<br>
Dim FormName As String, SyncCriteria As String<br>
Dim f As Form, rs As Recordset<br>
<br>
' form name to be syncronized<br>
FormName = &quot;AutoCAD&quot;<br>
<br>
'Define the from object and recordset object for the AutoCAD form<br>
Set f = Forms(FormName)<br>
Set rs = f.RecordsetClone<br>
<br>
' define the criteria used for the sync<br>
SyncCriteria = &quot;[Part_num]=&quot; & Chr$(39) & Me![Part_num] & Chr$(39)<br>
<br>
' find the corresponding record in the Parts table<br>
rs.FindFirst SyncCriteria<br>
f.Bookmark = rs.Bookmark<br>
-------------------------------<br>
Change the form name to match yours and change<br>
SyncCriteria = &quot;[Part_num]=&quot; to match a KEY field in your table<br>
---------------------<br>
If you want to sync the combo box based on the form<br>
then you need to find a KEY field on your form which is also in your combo box and then Move to its postion in the combo box recordset<br>
using combo1.listIndex(x) <br>
somehow...<br>

 
Try adding code to the Form_Current event. This event gets &quot;fired&quot; when the user switches from one row to another. <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top