RESULT before UPDATE RECORDSET (1 Viewer)

rickyfong

Registered User.
Local time
Today, 12:17
Joined
Nov 25, 2010
Messages
199
I got a doubt as follows:

No matter it is using ADDNEW or EDIT in recordset, values are assigned to different fields but before doing the UPDATE action, if I assigned those fields to another variables. Those fields content would also be assigned to those variable or only can those fields got values after the UPDATE action!??

FOR INSTANCE, T1 or T2 will got the same result as TRANS1![NAME] and TRANS1![QTY] ??


Dim TRANS1 As Dao.Recordset
Set TRANS1 = CurrentDb.OpenRecordset("select * " & " from MASTER order by INVOICENUM, dbOpenDynaset)

Dim T1 As STRING
DIM T2 as SINGLE

TRANS1.ADDNEW

TRANS1![NAME] = me.NAME
TRANS1![QTY] = ME.HIGH * ME.LENGTH

T1 = TRANS1![NAME]
T2 = TRANS1![QTY]

TRANS1.UPDATE

:
:
:
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:17
Joined
Aug 30, 2003
Messages
36,126
If I understand correctly, move those 2 lines above the lines where you set the recordset fields.
 

rickyfong

Registered User.
Local time
Today, 12:17
Joined
Nov 25, 2010
Messages
199
Sorry! Paul, I am asking the consequence but not how to solve it !! Thanks!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:17
Joined
Aug 30, 2003
Messages
36,126
I'm not sure what you're asking. Even though the table has not been updated, the recordset has, so you get the value from the recordset.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 20:17
Joined
Feb 19, 2013
Messages
16,618
name is a reserved word, so using it can cause issues -

me.name is the name of your form
 

Cronk

Registered User.
Local time
Tomorrow, 05:17
Joined
Jul 4, 2013
Messages
2,772
I think the question really is about the affect of recordset.update

The recordset is in memory, Adding a new record does not write it to the table until the update statement. However the values assigned to the recordset fields are in memory and other variables can be set to hold the same values as in
T2 = TRANS1![QTY]
and will hold the value while in scope whether the recordset is closed with or without an update.
 

Users who are viewing this thread

Top Bottom