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

GoTo record with 2 primary keys

Status
Not open for further replies.

NCH

Programmer
Feb 18, 2003
8
ZA
Hi,

I need to go to a record with two primary keys, using the access statement acGoTo.

Thanks,

Ninette
 
A table will NEVER have two primary keys! I believe what you have is a concatenated primary key, where two fields together make up the primary key. I do it often.

Must you use the acGoTo? First of all that's not a command but a parameter of a command. What would the command be?


Using the filter
----------------
strCriteria "Part1='" & Part1Value & "' and Part2='" & Part2Value & "'"
Me.Filter = strCriteria
Me.FilterOn = True

Using the bookmark (Moves to the first occurence of the criteri, which in you case would be the only occurence.
------------------
Dim myClone As Recordset
Set myClone = RecordsetClone
Set myClone = Me.RecordsetClone
myClone.FindFirst "Part1='" & Part1Value & "' and Part2='" & Part2Value & "'"
If myClone.NoMatch Then
'
Else
Me.Bookmark = myClone.Bookmark
End If -------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
The command would be :

DoCmd.GoToRecord ,,acGoTo, "record name"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top