mkirros
IS-IT--Management
- Feb 17, 2004
- 82
I have an Access 2002 project linked into a SQL Server 2000 back end, with about 300,000 records in the main table. I have a "lookup" form in which users enter the ID number (the primary key in the main table). The procedure behind the form then accesses the table, finds the record (if it exists), and opens a new form with the selected record as current. The problem is that it only works with about the first 2,000 records - if the record is deeper in the table than that, the first record is returned. I've tried resetting the MaxRecords property everywhere it can be reset, with no change. I'm new to working with Access projects linked to SQL Server back ends, so I may be missing something obvious. Here's the code that gets the record -
Dim tb1 As ADODB.Recordset
Dim cn As ADODB.Connection
Dim ConnectStr As String
Set cn = CurrentProject.Connection
Set tb1 = New ADODB.Recordset
tb1.MaxRecords = 0
tb1.Open "Select ID,LastName1,FirstName1,Phone1 from " _ tblOrganizerInfo", cn
tb1.Find "ID = '" & txtID & "'"
Dim tb1 As ADODB.Recordset
Dim cn As ADODB.Connection
Dim ConnectStr As String
Set cn = CurrentProject.Connection
Set tb1 = New ADODB.Recordset
tb1.MaxRecords = 0
tb1.Open "Select ID,LastName1,FirstName1,Phone1 from " _ tblOrganizerInfo", cn
tb1.Find "ID = '" & txtID & "'"