BlueJacket
Registered User.
- Local time
- Today, 07:42
- Joined
- Jan 11, 2017
- Messages
- 92
Can I use tempvar to carry on a value from one form to another? For instance, I have a form called frmClients, where the Client name is displayed from a combo box bound to the ClientID. I want to carry that ClientID value to another field in my next form.
To give you an example of what I'm (unsuccessfully) trying to do:
Which I was then thinking about recalling in my next form (frmNewProperty) like...
I know this code is not correct, as I'm getting errors saying TempVars cannot store objects (which I don't fully understand how I'm trying to store an object). I'm moreso trying to get a sense if this is the best way to go about what I'm trying to do.
Thanks in advance.
Edit: I did get figure out how to get the code to work, but my main question still remains if this is the best practice.
To give you an example of what I'm (unsuccessfully) trying to do:
Code:
Private Sub butNewProperty_Click()
If Me.Dirty Then
Me.Dirty = False
End If
Dim tvClientID As TempVars
TempVars!tvClientID = Me.cboClient
DoCmd.OpenForm frmNewProperty, , , , acFormAdd
DoCmd.Close acForm, Me.Name
End Sub
Which I was then thinking about recalling in my next form (frmNewProperty) like...
Code:
Private Sub Form_Open(Cancel As Integer)
Me.cboClient = TempVars!tvClientID
End Sub
I know this code is not correct, as I'm getting errors saying TempVars cannot store objects (which I don't fully understand how I'm trying to store an object). I'm moreso trying to get a sense if this is the best way to go about what I'm trying to do.
Thanks in advance.
Edit: I did get figure out how to get the code to work, but my main question still remains if this is the best practice.
Last edited: