Dlookup, CBO and ME

L

L. Woodhouse

In reference to an earlier question --

I got the answers (thank you!) but it is not recognizing ME in
Me!Name = Me!YourComboName.Column(1)

Name is theunit price and the field on the form is called
UnitPrice
YourComboName I am assuming is the name of the field that
the combo box appears in on the current form which would be
PROD

Therefore, I should type

Me!UnitPrice = Me!Prod.Column(1)

What am I missing?
 
S

Sandra Daigle

Where are you running this code? Is it in an event in the form's class
module? In the following:

Me!Name = Me!YourComboName.Column(1)

'YourComboName' should be replaced with the name of the combo control. Click
on it and look at the Name property under the Other tab. What you find there
is what goes in the above.

What is the error you are getting? If the code is not in the form's class
module, you have to use a full reference to the form:

Forms!frmMyForm.MyControl=orms!frmMyForm.YourComboName.column(1)

Where you replace 'frmMyForm' with the name of the form.

*I Must point out again that in the first example above, Name is a very bad
choice for a field or control name. Please do not use it!!*
 
G

Guest

I got everything working with the lookup box! Thanks.

Two questions:

1) If I later wanted to change it so that customer
information could be edited from the order form; can I do
this and how?

2) I am working on setting up a printed invoice. I need to
transfer to same information to a report. How do I do that?
 
S

Sandra Daigle

Answers inline:
Two questions:

1) If I later wanted to change it so that customer
information could be edited from the order form; can I do
this and how?

I typically provide a link from the form for the "Many" side of the
relationship (Orders) to the detail record for the record from the table on
the "One" side. (IOW there are Customers:Orders is 1:M). I usually do this
with a command button next to the Custid lookup control and with a double
click event on the same control (one or the other would be sufficient). The
code for this event is pretty simple:

docmd.openform "frmCustomers", , , "Custid=" & Me.Custid

2) I am working on setting up a printed invoice. I need to
transfer to same information to a report. How do I do that?

In the RecordSource query for the report, just join the Customers table to
the Invoice table then add any required columns from either table. Then add
the InvoiceDetails by creating a linked subreport.

Be sure to post back if you still have questions.
 

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