View Full Version : passing a variable between 2 forms


will
12-28-2001, 09:50 AM
I am trying to pass values entered from one form into the text box of another form. I have one form where I record payments from clients, and I would like the information displayed in a textbox of my main form, but I keep getting the error that "(my database) cannot find the field XXX referred to in your expression", the code that I am using to pass the variables is as follows,
(a and b are the payment date and amount)

dim e as string
e = a + b
Forms!MainForm!Subform!Field = e

I think it has something to do with global variables, but im not sure, can anyone help?
Thanks!

Jack Cowley
12-28-2001, 10:30 AM
You did not say, but it appears that you have a form/subform combination. This article will show you how to refer to fields in a subform...
http://support.microsoft.com/support/kb/articles/Q209/0/99.ASP?LN=EN-US&SD=gn&FR=0&qry=subforms&rnk=5&src=DHCS_MSPSS_gn_SRCH&SPR=ACC2000