Me.Property

  • Thread starter West Preston via AccessMonster.com
  • Start date
W

West Preston via AccessMonster.com

I have a data entry form with a combo box/text box for the vendorName and
vendorID.

On this form, I have a sub form with fields: notes, date, time, vendorID.
I have a notes table to capture the notes. When I save the form it save
the notes to my notes table, but does NOT save the vendor id. This field
is left blank in my notes table. It saves the jobOrder I think because
it's the primary key, but not the vendorID.

Can anyone help me with my code? Here it is:

Private Sub Notes_Enter()
NoteDate = Date
NoteTime = Time()
Me.Companyid = Companyid
Me.JobOrder = JobOrder
End Sub
 
W

West Preston via AccessMonster.com

Further explanation:

My Combo/textbox after update code is:

Private Sub Combo170_AfterUpdate()
Me!TxtCompanyid = Me!Combo190.Column(0)
Me!CompanyName = Me!Combo190.Column(1)

End Sub

I need the TxtCompanyid from my mainform to populate the companyid field on
my subform.

Does anyone have the code to do this???

Thanks!
 
A

Albert D.Kallal

You need to move the code to the sub-forms before-insert event. You also
want to do this, since if the user does NOT type anything in, then you don't
accidentally create a record. Further, with your example code, what happens
if the user adds MORE then one record...how will you code fire again? using
on-enter means that your code only fires ONCE..and worse a sub-form record
has not even been added yet when you code runs...

The code in the on-insert should be:

NoteDate = Date
NoteTime = Time()

Companyid = parent!Companyid
JobOrder = parent!JobOrder

If the job order does not change, then you only really need the companyid
set, and the rest of the info you get because ms-access is a relational
database.
 
W

West Preston via AccessMonster.com

It worked.....

Thank you for your quick reply and excellent direction.

West
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top