Cannot set combo on form load (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 21:42
Joined
Sep 21, 2011
Messages
14,047
Hi all,

Having a mental block here.:banghead:
I have form A which has a button to open form B with
Code:
Private Sub cmdAddSubmitter_Click()
DoCmd.OpenForm "frmSubmitter", , , , acFormAdd, acDialog, Me.IntroducerID
End Sub
and in the form B load event I have
Code:
Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
    Me.IntroducerID = Me.OpenArgs
End If
End Sub
Form B is merely to link a Submitter to an Introducer.
The table Form B is based on is tblSubmitter as shown in the rlationship diagram
The strange thing is the form for tblSubmitterClient is the same structure and that works fine?
Code:
Private Sub cmdAddSubmitter_Click()
DoCmd.OpenForm "frmSubmitterClient", , , , acFormAdd, acDialog, Me.ClientID
End Sub

Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
    Me.ClientID = Me.OpenArgs
End If
End Sub
I now I am doing something stupid here, but for the life of me cannot spot it.:banghead:
Could someone please point me to my error.?

TIA
 

Attachments

  • Form Load.PNG
    Form Load.PNG
    14.7 KB · Views: 37
  • Comm relationship.jpg
    Comm relationship.jpg
    90.8 KB · Views: 35

Ranman256

Well-known member
Local time
Today, 17:42
Joined
Apr 9, 2015
Messages
4,339
assign the combo in the same place you opened the form:
openform "myform"
forms!myform!cboBox = "abc"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:42
Joined
May 7, 2009
Messages
19,169
on the way you open those form's, they are all in Add record mode always, is this your intention?
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:42
Joined
Sep 21, 2011
Messages
14,047
Ranman256

I get the same error?

Code:
Private Sub cmdAddSubmitter_Click()
DoCmd.OpenForm "frmSubmitter", , , , acFormAdd, acDialog, Me.IntroducerID
Forms!frmSubmitter!IntroducerID = Me.IntroducerID
End Sub
I am not going to be able to reply after this, sorry. On holiday for a week, but will need to pick up on my return.

Really puzzled why it works for one and not the other.?


assign the combo in the same place you opened the form:
openform "myform"
forms!myform!cboBox = "abc"
 

Users who are viewing this thread

Top Bottom