assign value to variable in form module 
Author Message
 assign value to variable in form module

Greetings,

Using Access 7

have main form and subform, subfrom has many to each main form

subform has a mfrcode, trackingcode and quantity

if user needs to edit a subform record.....

i need to reset two values in another table

am using recordset to seek and do the update

PROBLEM:

i want to grab current values of record, place them in temp variables,
do the edit, and on the form before update, do all the error checks
and then do all the updating

Have tried to pick up the value, however do not seem able to assign
it correctly to a variable.

Variable is declared in the declaration section of the form, but

varName=Me!controlname.OldValue        

varName never picks up a value, watch tells me it is out of context

Any help appreciated.
Am fairly new at this, so if I'm missing something very obvious, u can
finish laughing before responding in this group or via email

Peter
************

delvalnet.com
http://www.*-*-*.com/
web creation and hosting



Wed, 22 Mar 2000 03:00:00 GMT  
 assign value to variable in form module



Quote:
> Greetings,

> Using Access 7

> have main form and subform, subfrom has many to each main form

> subform has a mfrcode, trackingcode and quantity

> if user needs to edit a subform record.....

> i need to reset two values in another table

> am using recordset to seek and do the update

> PROBLEM:

> i want to grab current values of record, place them in temp variables,
> do the edit, and on the form before update, do all the error checks
> and then do all the updating

> Have tried to pick up the value, however do not seem able to assign
> it correctly to a variable.

> Variable is declared in the declaration section of the form, but

> varName=Me!controlname.OldValue        

> varName never picks up a value, watch tells me it is out of context

I'd need to see more of your code to be sure, but I'll bet that your
problem is that you're trying to use varName in your subform, and you have
it declared in your main form.  If you reference a variable in code that's
a part of your subform, you need to declare that variable within the
subform too.

Alternatively, you can declare varName as Public within your main form, and
then reference it within your subform by using Me.Parent.varName.  I
wouldn't do this without a good reason, though.

I hope the problem I'm trying to help solve here is the problem you're
actually having.

Bob Rossney



Fri, 24 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Is it possible to assign a form value to a Session variable in Javascript

2. Assigning the value to the value of a variable

3. Pass variable value back to form from module

4. Passing input box value from Form Module to report module

5. Assign a value to a variable using Select

6. ACC 97: Assign values to variables

7. Decimal precision when assigning values to variables

8. Assigning the value of a variable to a control in Vba

9. CAN'T ASSIGN A NULL VALUE TO A VARIABLE

10. Assign variable a value in a table with vba, acc97

11. Assigning a value from a list box to a variable

12. Assigning value to textbox if textbox is a variable name

 

 
Powered by phpBB® Forum Software