Goto Record/Find Record (1 Viewer)

David_P

Registered User.
Local time
Today, 05:35
Joined
Aug 17, 2010
Messages
30
I am trying to get my form to bring up a certain record based on a combo box. The combo box's list is based on a query that is filtered based on data typed in to several control text boxes. I got the combo box to bring up the PK of the record that I want to edit but it won't move that that record.

I tried to use the Goto Record function but don't know how to go to a certain recorded based on the PK. The Record Number doesn't equal the PK Number. So record 5 isn't PK 5.

I can't seem to figure out the Find Record function so it will look up the PK in the table that is selected.

So I need to have the form pull up the record from the table dbo_Transactions using the selected number in the combo box dbo_Transactions_ID on the form Transactions - Time Change using the PK ID of the table dbo_Transactions.

Table: dbo_Transactions
Table PK: ID
Form: Transacions - Time Change
Combo Box Control: dbo_Transactions_ID

Hope I explained that correctly and clearly enough.

Thanks for your help
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:35
Joined
Aug 30, 2003
Messages
36,118
Have you tried the bookmark method? It would look something like:

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Me.dbo_Transactions_ID
Me.Bookmark = rs.Bookmark
 

David_P

Registered User.
Local time
Today, 05:35
Joined
Aug 17, 2010
Messages
30
I am getting the error "The specified field 'ID' could refer to more than one table listed in the FROM clause of your SQL statement".

The query that the combo box is pulling from has 3 tables tied to each, and each of the tables PK is labled as ID. Can't change the PK name because the database they are assoicated with won't allow it.

When I change the line: rs.FindFirst "[ID] = " & Me.dbo_Transactions_ID to rs.FindFirst "[dbo_Transactions.ID] = " & Me.dbo_Transactions_ID to identify the table I want it to look in I get the error "Unknown or invalid field reference [dbo_Transactions.ID".
 

ghudson

Registered User.
Local time
Today, 08:35
Joined
Jun 8, 2002
Messages
6,195
You can change the field names in the query. Instead of having three versions of the ID field you would have three variations. Table1ID, Table2ID, Table3ID, etc. That should help with your error.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:35
Joined
Aug 30, 2003
Messages
36,118
I think your brackets are off. Try

rs.FindFirst "[dbo_Transactions].[ID]...
 

David_P

Registered User.
Local time
Today, 05:35
Joined
Aug 17, 2010
Messages
30
>Hits forhead with open palm - saying duh!<

That fixed it.

Thanks for your help help.
 

Users who are viewing this thread

Top Bottom