Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set SubForm Control Default Vaule from MainForm

Status
Not open for further replies.

ragu111

MIS
Aug 15, 2002
129
AE
IN MY SUBFORM I PUT BELOW CODE:

Code:
Private Sub Amount_AfterUpdate()
If Me.C_Code = "c" And Me.Cost = 0 Then
Me.Cost = Me.Amount
[RED]Me.C_ACODE = [Forms].[CusMaster].[Customs_Code].Column(2)[/RED]
Else
Me.Cost = Me.Cost
End If
End Sub
on the subform "C_ACODE" field i wanted to call the value from MainForm.Customs_Code.Column(2) as a default value.
but the above code is not working.

On the SubForm where ever the C_Code is "c" i wanted to update the C_ACODE as MainFrom Customs_Code.Column(2)

ragu[pc]
 
How are ya ragu111 . . .

. . . and this:
Code:
[blue]   Dim cbx As ComboBox, DQ As String
   

   Set cbx = Forms!CusMaster!Customs_Code
   DQ = """"

   If Me.C_Code = "c" And Me.Cost = 0 Then
      Me.Cost = Me.Amount
      [purple]Me.C_ACODE.DefaultValue = DQ & cbx.Column(2) & DQ[/purple]
   End If

   Set cbx = Nothing[/blue]
BTW: To get great answers be sure to have a serious look at FAQ219-2884 or FAQ181-2886

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top