ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Form 2 Form data transfer (https://www.excelbanter.com/excel-programming/337891-form-2-form-data-transfer.html)

Madduck

Form 2 Form data transfer
 
Hi all,

I need help

I have made a form where u input data that on closing is transfered to a
worksheet

eg: Range("d3").Value = Membernumber.Value

on this form I have placed a button that unhides another form for optional
info.
I want to transfer this info to some hidden text boxes so that on closing
the main form all data is transfered to the worksheet.

I have used this code on closing the second form but it doesn't work.

UserForm1!advisername.Value = advisername.Value
UserForm1!apptdate.Value = Appt_date.Value
UserForm2.Hide

THanks in advance
Mark

DM Unseen

Form 2 Form data transfer
 
Use

Unload UserForm2

to get rid of it.

DM Unseen


Madduck

Form 2 Form data transfer
 
Sorry , I was unclear...

The problem isn't hiding the form... It is transfering the data from one
form to the other...

UserForm1!advisername.Value = advisername.Value
UserForm1!apptdate.Value = Appt_date.Value

This is the code that doesn't work.


"DM Unseen" wrote:

Use

Unload UserForm2

to get rid of it.

DM Unseen



DM Unseen

Form 2 Form data transfer
 
mm,

This should be put in the QueryClose event.

I would use

UserForm1.advisername.Value = advisername.Value
UserForm1.apptdate.Value = Appt_date.Value

The Exclamation I have never used in XL(but only in Access).

BTW if you need hidden info in your Form, you could use property
get/Let


Property Let MyDate(dt as Date)
' do something here, set it to a variable.
End Property

or a global variable in your Forms Code (is even easier)

Public MyDate as Date

Both will work as an extra property of your USerForm1 object

and in your subform you can state

UserForm1.mydate = dtThisDate

DM Unseen


Madduck

Form 2 Form data transfer
 
Ahh silly me , thanks.

I've done most of my programming in access... removing the ! should work. ta
again

Mark

"DM Unseen" wrote:

mm,

This should be put in the QueryClose event.

I would use

UserForm1.advisername.Value = advisername.Value
UserForm1.apptdate.Value = Appt_date.Value

The Exclamation I have never used in XL(but only in Access).

BTW if you need hidden info in your Form, you could use property
get/Let


Property Let MyDate(dt as Date)
' do something here, set it to a variable.
End Property

or a global variable in your Forms Code (is even easier)

Public MyDate as Date

Both will work as an extra property of your USerForm1 object

and in your subform you can state

UserForm1.mydate = dtThisDate

DM Unseen




All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com