I want to create a customer ID field in a table as an autonumber that will link the customer table to other tables but I want the rest of the customer information to be input with a form. I want to be able to then using a query, update the customer info and save the ID number as a variable to be used by subsequent forms which will also update with a query. Any suggestions?
if you want to share a value amongst multiple forms AND you cannot guarantee that one particular form will always be open during the sharing, you need a global variable.
last item on the left of your database window Tables/Queries/Forms...... is Modules.
global myGlobalVariable as long 'or whatever it is
downside of modules is that the first reference to a sub/func/var/const in a global module loads the entire module into memory and it stays there until you quit the application ...so you should try to minimise the number of globals you use.
if you do have a form that will always be open during the sharing process, it is tidier to put your shared variable on that form (when the form is closed, memory is cleared). at the top of the code, just before the first sub/func use
public myPublicVariable as long 'or whatever
I could actuall set the visible property of the customer info form to false so that way the value in the customer ID field is still in memory. What I needed was how to declare the variable which is public. Thank you for jogging my memory. I used to program in access for a job but being out of work for a year you get rusty.