General discussion


Access - form to sub form automatic entry

By ricky4143 ·
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?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

A possibility

by talentonloan In reply to Access - form to sub form ...

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

Forms!Mainform!txtboxName = vName
End if

Exit Sub

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

End Sub

hope that helps


Related Discussions

Related Forums