Taking value from one form and putting it to another

E

Eric B.

I'm hoping someone here can help me.

I have a form that has a drop down list that I can select
product codes from. I then have a checkbox that has a form
pop-up if it is clicked. What I am trying to accomplish is
the values from frmAnalysisFilm go into my other form
called frmScrapped, but I get a error 2448 - cannot assign
a value to this object. Any ideas? Here's the code I am
using:

Private Sub Form_Open(Cancel As Integer)

Dim UserID As Long
Dim ACode As Integer

UserID = Forms!frmPassword!cboEmployee
ACode = DLookup("AccessLevelID", "tblUser", "ID = " &
UserID)

Me.Mach.Enabled = False
Me.Product.Enabled = False
Me.Date_Scrapped.Enabled = False
Me.DateProduced.Enabled = False
Me.Reason.Enabled = False
Me.Operator.Enabled = False
Me.PoundsScrapped.Enabled = False
Me.Skid.Enabled = False
Me.Roll.Enabled = False
Me.ScrappedBy.Enabled = False

If ACode < 1 Then
Me.Command20.Enabled = False
Me.Command21.Enabled = False
Me.Command22.Enabled = False
Me.Command24.Enabled = False
Else
If SysCmd(acSysCmdGetObjectState,
acForm, "frmAnalysisFilm") <> 0 Then
Me.Mach.Enabled = True
Me.Product.Enabled = True
Me.Date_Scrapped.Enabled = True
Me.DateProduced.Enabled = True
Me.Reason.Enabled = True
Me.Operator.Enabled = True
Me.PoundsScrapped.Enabled = True
Me.Skid.Enabled = True
Me.Roll.Enabled = True
Me.ScrappedBy.Enabled = True
Me.Command23.Enabled = False
Me.Mach.Value = [Forms]![frmAnalysisFilm]!
[MachineID]
Me.Product.Value = [Forms]![frmAnalysisFilm]!
[Product]
Else: End If
End If

DoCmd.Maximize
End Sub
 
W

Wayne Morgan

The Open event may be too soon to assign values to the controls, try the
Load event instead.
 
G

Guest

Me.Mach.Value = [Forms]![frmAnalysisFilm]![MachineID]
Me.Product.Value = [Forms]![frmAnalysisFilm]![Product]

I had to take out the brackets to make it work. DUH!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top