Article ID: 110497
Article Last Modified on 10/30/2003
Sub Form_Load ()
form1.Show ' In Load event, must Show form to make Print visible.
Dim MyDB As Database, MyTable As Table, testval As Long
' Several duplicates exist in BIBLIO.MDB for PubID = 2 in Titles table.
' testval is the key value for which you want to Seek all duplicates:
testval = 2
Set MyDB = OpenDatabase("BIBLIO.MDB") ' Open a database.
Set MyTable = MyDB.OpenTable("Titles") ' Open a table.
' Sort the Titles table by the PubID indexed field, which is designed
' with duplicates OK:
MyTable.Index = "PubID"
MyTable.Seek "=", testval ' Seek a record with PubID key = testval.
If MyTable.NoMatch Then
MsgBox "Match for " & testval & " was not found"
Else
Do
Print MyTable!PubID & ": " & MyTable!Title
x = MsgBox("Match was found. PubID = " & MyTable!PubID & ": ", 1)
If x = 2 Then End ' End if user clicks Cancel on message box.
MyTable.MoveNext ' Move to next record.
If MyTable!PubID <> testval Then Exit Do 'Stop when past testval.
Loop
End If
Additional query words: 3.00
Keywords: KB110497