Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on declaring a variable that holds its values 1

Status
Not open for further replies.

JunglesMcBeef

Programmer
Sep 18, 2003
266
G'day,

I have created a type and created an array from that type in the general declarations. I have 2 event procedures invoked with a respective command button each. The first procedure fills the array with the current text box values on the form (only one record ie one element of the array). I want my array to be able to hold the values between calls so I can use the second procedure to write the contents of the array to the table after using the first procedure to fill the array with many items. What I guess I am trying to say is whether or not you can declare a static variable outside of a procedure and what to declare it as. Or can anybody suggest a better way to get around this?
 
Have you tried the Public instruction ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Yes, that didn't work. I think the fact that it is an array might be causing the problem, but i'm not sure.
 
Have you tried the Public instruction in a Module

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Yeah it gives me the same error message. I am going to change it so it writes to the table directly for each record when the procedure is fun, it will only take some rearranging of my code. Surely there is some better way to get this functionality working though?
 
Yeah it gives me the same error message
Which error ? Where ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Actually you were right with putting it into a module. The coding works fine now. I had just forgot to delete it from the other declarations.

I also have another question if you are willing to help, when I run a report based on a query related to these entries I cannot get a calculated field to work in the report. I am using a text box with the expression:
=Sum([Quantity]*[Price]*0.1 + [Quantity]*[Price])
When the report is run the box returns: #Error

Any ideas on why this may happen?
 
Take a look at the DSum function.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top