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

Grids on a Tabs Form

Status
Not open for further replies.

Shirley

Programmer
Aug 30, 1999
198
US
I have a grid on a Access 2003 tab form, that I will like to use as a search engine. Once the user select the record, I have a button that is suppose to select the primary key on the grid and use it to find that record on the first tab. I used to use the following process.

If Not IsNull([subContract].Form.TransID) Then
TransID.SetFocus
DoCmd.FindRecord [subContract].Form.TransID
TransID.SetFocus
End If

But now in Access 2003 there is no FindRecord method, even though it give me help on the FindRecord methods and action. Can anyone help me with this problem. It is driving me crazy. If there is a marco that I can create or a query. Please let me know.
 
This is not very clear, but I'll take a stab at what I think you are looking for.
As I understand it, you have some sort of selection on one tab, and after making that selection, you want to select the record on another form (on another tab) that matches the selection just made.
If that is right, the only way I know to do that anymore is to create a recordset that is a clone of the recordset for the form you want to find the record on. With the clone recordset, you can do a ".findfirst" Here is the code I used to test this (and it worked)
Within this code, "Text0" is the name of the field that holds the value to will point to the record you want displayed on the secondary form.
"XfrmConstants" is the name of the form where you want the specified record displayed.

Good luck!

Code:
Private Sub Command2_Click()
Dim rs As DAO.Recordset
Set rs = Forms!XfrmConstants.RecordsetClone

  rs.FindFirst "ID=" & Me!Text0
  If rs.NoMatch Then
    MsgBox "Match not found"
  Else
    Forms!XfrmConstants.Bookmark = rs.Bookmark
  End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top