473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Wrong record retrieved after move to SQL Svr

J
I've moved the database tables from the .mdb file to Sql Svr and now I have
an *intermittent* problem. When I select a record from a combo box, it will
intermittently pull up the wrong record. The code that does the search is
below. I have a column named 'ProsId' that is a unique number (identity
column). The error -- when it happens -- seems to only happen on higher
ProsId numbers. At first it appeared to me as some sort of data conversion
thing, but I'm not so sure now. Here's some examples:

Record selected Record actually displayed
---------------- -------------------------
100,000 41,859
59,073 15,794
57,000 11,273
57,001 11,274
45,000 45,000 <--- appears to return correct
value every time. Numbers lower than this also seem to return the correct
record every time.
Private Sub cboFindProsName_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

If Len(Trim(Me.cboFindProsName.Text)) > 0 Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[ProsId] = " & (Me![cboFindProsName])
Me.Bookmark = rs.Bookmark
End If

End Sub
Many Thanks!

Nov 13 '05 #1
3 2278
J wrote:
I've moved the database tables from the .mdb file to Sql Svr and now I have
an *intermittent* problem. When I select a record from a combo box, it will
intermittently pull up the wrong record. The code that does the search is
below. I have a column named 'ProsId' that is a unique number (identity
column). The error -- when it happens -- seems to only happen on higher
ProsId numbers. At first it appeared to me as some sort of data conversion
thing, but I'm not so sure now. Here's some examples:

Record selected Record actually displayed
---------------- -------------------------
100,000 41,859
59,073 15,794
57,000 11,273
57,001 11,274
45,000 45,000 <--- appears to return correct
value every time. Numbers lower than this also seem to return the correct
record every time.
Private Sub cboFindProsName_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

If Len(Trim(Me.cboFindProsName.Text)) > 0 Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[ProsId] = " & (Me![cboFindProsName])
Me.Bookmark = rs.Bookmark
End If

End Sub
Many Thanks!


Is it really finding the record? If you know when you are searching for
an incorrect record, you may also want to step through your code. Maybe
try it without the () around the (ME![cboFindProsName]) Maybe the table
is corrupt. Do you have a filter so the records can't be found? Check
your recordsource too. Create a query and open it up and filter it on
high-end numbers, see what happens.

rs.FindFirst "[ProsId] = " & (Me![cboFindProsName])
If not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
msgbox "Record not found"
Endif

Nov 13 '05 #2
J wrote:
I've moved the database tables from the .mdb file to Sql Svr and now I have
an *intermittent* problem. When I select a record from a combo box, it will
intermittently pull up the wrong record. The code that does the search is
below. I have a column named 'ProsId' that is a unique number (identity
column). The error -- when it happens -- seems to only happen on higher
ProsId numbers. At first it appeared to me as some sort of data conversion
thing, but I'm not so sure now. Here's some examples:

Record selected Record actually displayed
---------------- -------------------------
100,000 41,859
59,073 15,794
57,000 11,273
57,001 11,274
45,000 45,000 <--- appears to return correct
value every time. Numbers lower than this also seem to return the correct
record every time.
Private Sub cboFindProsName_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

If Len(Trim(Me.cboFindProsName.Text)) > 0 Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[ProsId] = " & (Me![cboFindProsName])
Me.Bookmark = rs.Bookmark
End If

End Sub
Many Thanks!

One other thing. Do you have a combo populated with 100K rows? Perhaps
you have exceeded some sort of combo box limit....I have no idea if
there is a limit but to create a combo with that many rows may cause
Access to choke. I would find that number of rows in a combo ridiculous.

Nov 13 '05 #3
I am going to guess that you are basing your combobox on an ODBC table.
If this is the case, just know, that ODBC (for Sql Server to Access) is
mostly legacy technology. ODBC has a constantly open connection with
little bandwidth compared to ADO. ODBC works OK with small tables of a
few thousand records or less, more than 20-30k you will have problems
with ODBC (I would really say more than 10k of records). This is why ADO
was developed. What I do is to create the same table in Access as the
one in Sql Server. Pull in a subset of data from the sql table to the
Access table (which acts like a temp/buffer table), using ADO, then use
VBA to manipulate the data in your Access buffer table.

As for seaching for a specific record, pick a value from your combobox
which is based on an Access Buffer table (with data you pulled in from
Sql Server) then use an ADO command object to fetch the desired record
from Sql Server:

Dim cmd As New ADODB.Command, RS As New ADODB.RecordSet

...
cmd.CommandType = adCmdText
cmd.CommandText = "Select * From tblX Where fldx = '" & cbo1 & "'"
Set RS = cmd.Execute
...

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: J | last post by:
I've moved the database tables from the .mdb file to Sql Svr and now I have an *intermittent* problem. When I select a record from a combo box, it will intermittently pull up the wrong record. ...
3
by: Alan Pocklington | last post by:
Hi, I've created a Java Applet that allows the user to select a record. As the user makes the selection, the applet uses LiveConnect (JSObject) to write the record id to a html field (the name...
2
by: aaj | last post by:
Hi all I have a small but rather annoying problem with continuos forms, and am wondering if anyone can suggest a method of getting over it. The front end is Access 2002 with the BE being SQL...
17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
0
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record...
3
by: SJM | last post by:
I have a problem that occurs occasionally with a db for a undetermined reason which I would love to solve. I construct and append a series of 7 records to a table using ADO recordset. Each record...
4
by: James P. | last post by:
Hello there, I have a bound-form using Navigator so that the user can move back and forth to update record in the form. Every time a record was modified and the user clicks the Navigator to...
6
by: doncee | last post by:
This is the set up: is a date field on a form. Its control source is the field "date_entered" in"Table1". If there is a date showing in the date_entered field (Text6) & the status in Combo box2...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
0
by: mukeshrasm | last post by:
Hi I wanted to move record up or down or top or bottom if user selects up or down or top or bottom from select box. records are coming from database. while saving record I am assigning no. to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.