Discussion Locked

Access - form to sub form automatic entry

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm trying to refine my Invoice Tracking program to have to vendor name automaticly entered on the parts sub form. Made a text box on the subform and clicked on the table line in the data box to the vendor table on the sub form. Then tried [Form]![Name of form]![Combo Box9]in the property box under data validation rule. Even the expression builder doesn't come up with a formula that works.

Any ideas?

1 reply

by talentonloan

Hi Ricky

You might try to do it in VB code. Figure out when you want an event to trigger - ie. using the 'On update' event of the name on the Main form. (My spelling may cause an error in this but it is the concept...) Then create a little routine to do what you want:

Private Sub ComboBox9_Change

On Error GoTo Err_ComboBox9_Change
Dim varName As Variant
'Populate subform

dim vName as variant

'Use variant in the event it is null.

vName = Me.combobox9

'You will want to check for null values or empty strings and avoid update.

If vName = "" or IsNull(sname) = true then

Goto Exit_ComboBox9_Change

Else
Forms!Mainform!txtboxName = vName
End if

Exit_ComboBox9_Change:
Exit Sub

Err_ComboBox9_Change:
MsgBox = Err.Number & " : " & Err.Description
GoTo Exit_ComboBox9_Change

End Sub

hope that helps

tol

This discussion is closed to new replies.