var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Opening recordset
If I open my recordset in the followin manner:
rs.open "TableName", CN, adOpenKeyset, adLockOptimistic
Will it load the content of the whole table into memory?
should I be doing this instead?
rs.open "Select * From TableName Where AutoNumberKey = -1"
here is some sample code that my help - remember any other manipulatin using the rs.open may cause you to lose the connection so look at this as a partial solution
Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim stQuery as String
'myTable = whatever your table is called.
stQuery = "SELECT * FROM myTable ORDER BY name"
Set .ActiveConnection = con
.CommandType = adCmdText
.CommandText = stQuery
.LockType = adLockPessimistic
.CursorType = adOpenKeyset
If rs.RecordCount > 0 Then
Set Adodc1.Recordset = rs
This isn't what I'm asking.
I want to know if I open a recordset using the table name, will it load the content of the whole table into memory??
well now, i can't directly answer your question, but if you absolutely do want the entire recordset loaded into memory you need to take special action.
e.g. if you want to be sure you get the right answer from rex.recordcount you should first do a rex.movelast to get everything loaded.
if you only want a subset of records, then logically you should use the WHERE
what access does by default is somewhere between one and all records, but i can't give you the definition.
What I want to do is the followin.
I want to open the recordset before using the .AddNew method.
I want the most efficient way that's why I'm asking if using the table name will load the whole table into memory or not.
the answer is yes the recordset will load into memory provided there are no memory constraints to prohibit the load.
if your goal is minimum memory use, and your only intent behind opening the recordset is .addnew then construct your WHERE with as much stuff from your wannabe new record as possible... if you are lucky your recordset will be empty. it's not all bad to do this anyway, since .recordcount > 0 shows duplicate records which might be helpful.
your WHERE could look like
fldLastName = boxNewLast.Value and fldFirstName = boxNewFirst.value
etc... in an attempt to not select any of the existing records