I have an order form that auto-populates details from the customer table into adderss and contact controls. But I don't want it to auto-populate when the underlying order table already has data in the related fields. I am a complete novice so I am sure the answer will eb simple. Here is the code I use on Load form event...
======
Private Sub Form_Load()
'Use this version if the ID is a number
Dim x As Variant
Dim strControl As String
Dim lngID As Long
'If parameters exist, use them
If Len(Me.OpenArgs) > 0 Then
'Split creates a zero-based array from the input string
x = Split(Me.OpenArgs, "|")
strControl = x(0)
lngID = x(1)
Me(strControl) = lngID
End If
Me.Ship_Contact = Me.CustiDcbo.Column(2) + " " + Me.CustiDcbo.Column(3)
Me.Ship_Tel = Me.CustiDcbo.Column(8)
Me.Ship_Addressee = Me.CustiDcbo.Column(1)
Me.Ship_Address = Me.CustiDcbo.Column(4)
Me.Ship_Suburb = Me.CustiDcbo.Column(5)
Me.Ship_State = Me.CustiDcbo.Column(6)
Me.Ship_PCode = Me.CustiDcbo.Column(7)
Me.Ship_Country = Me.CustiDcbo.Column(15)
Me.Order_Contact = Me.CustiDcbo.Column(2) + " " + Me.CustiDcbo.Column(3)
Me.Order_Cell = Me.CustiDcbo.Column(8)
Me.Order_Email = Me.CustiDcbo.Column(9)
Me.Bill_Address = Me.CustiDcbo.Column(10)
Me.Bill_Suburb = Me.CustiDcbo.Column(11)
Me.Bill_State = Me.CustiDcbo.Column(12)
Me.Bill_PCode = Me.CustiDcbo.Column(13)
Me.Bill_Country = Me.CustiDcbo.Column(14)
Me.DelZone = Ship_PCode.Column(1)
Me.ShipMethod = Ship_PCode.Column(2)
Me.ShipVia = Ship_PCode.Column(3)
End Sub
======
======
Private Sub Form_Load()
'Use this version if the ID is a number
Dim x As Variant
Dim strControl As String
Dim lngID As Long
'If parameters exist, use them
If Len(Me.OpenArgs) > 0 Then
'Split creates a zero-based array from the input string
x = Split(Me.OpenArgs, "|")
strControl = x(0)
lngID = x(1)
Me(strControl) = lngID
End If
Me.Ship_Contact = Me.CustiDcbo.Column(2) + " " + Me.CustiDcbo.Column(3)
Me.Ship_Tel = Me.CustiDcbo.Column(8)
Me.Ship_Addressee = Me.CustiDcbo.Column(1)
Me.Ship_Address = Me.CustiDcbo.Column(4)
Me.Ship_Suburb = Me.CustiDcbo.Column(5)
Me.Ship_State = Me.CustiDcbo.Column(6)
Me.Ship_PCode = Me.CustiDcbo.Column(7)
Me.Ship_Country = Me.CustiDcbo.Column(15)
Me.Order_Contact = Me.CustiDcbo.Column(2) + " " + Me.CustiDcbo.Column(3)
Me.Order_Cell = Me.CustiDcbo.Column(8)
Me.Order_Email = Me.CustiDcbo.Column(9)
Me.Bill_Address = Me.CustiDcbo.Column(10)
Me.Bill_Suburb = Me.CustiDcbo.Column(11)
Me.Bill_State = Me.CustiDcbo.Column(12)
Me.Bill_PCode = Me.CustiDcbo.Column(13)
Me.Bill_Country = Me.CustiDcbo.Column(14)
Me.DelZone = Ship_PCode.Column(1)
Me.ShipMethod = Ship_PCode.Column(2)
Me.ShipVia = Ship_PCode.Column(3)
End Sub
======