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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set a Current Record

Status
Not open for further replies.

nufather

Programmer
Mar 18, 1999
29
US
How do I set current record? I am having a problem setting current record - when I open my form I am at the first record of the table -when I type the code to dim db and recordset and have it select the record "if record <> current record then record = record + 1" but it comes back says no current record? any clues
 
I don't really understand what you mean. But, you could possibly use a bookmark. <br>
<br>
or do you mean...<br>
<br>
If rst.keyfield &lt;&gt; 1 then<br>
rst.movenext<br>
end if<br>
<br>
Or you could loop through the recordset until you find the correct record.
 
Try this I use it quite often<br>
<br>
Dim formname As String, Syncriteria As String<br>
Dim f As Form, rs As Recordset<br>
<br>
' form name to be syncronized<br>
formname = &quot;CreateNewRA&quot;<br>
<br>
' check to see if the from is open<br>
If Not SysCmd(SYSCMD_GETOBJECTSTATE, A_FORM, formname) Then<br>
DoCmd.OpenForm formname<br>
End If<br>
<br>
'Define the from object and recordset object for the Products form<br>
Set f = forms(formname)<br>
Set rs = f.RecordsetClone<br>
<br>
' define the criteria used for the sync<br>
SyncCriteria = &quot;[CUST_ID]=&quot; & Me![CUST_ID]<br>
<br>
<br>
' find the corresponding record in the Products table<br>
rs.FindFirst SyncCriteria<br>
f.bookmark = rs.bookmark<br>
<br>
DougP<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top