Form control value update via SQL quick 'n' easy statement help...

  • Thread starter Thread starter blfreei
  • Start date Start date
B

blfreei

Greetings.

I'll keep my question short. I can do the following...
Me!lstDisplayInvoices.RowSource = "SELECT [qryInvoice
Display].InvoiceNumber, [qryInvoice Display].DateScanned FROM
[qryInvoice Display];"

What is a quick and easy method of performing the line below...
Me!CustomerName.Value = "SELECT tblCustomers.CustomerName FROM
tblCustomers WHERE tblCustomers!CustomerNumber = Me!CustomerNumber;"

Obviously it posts the quoted text to the form instead of executing the
query. Said query should only return 1 result, and if it doesn't I
only really care about the first result.

Thanks!

-- John
 
Greetings.

I'll keep my question short. I can do the following...
Me!lstDisplayInvoices.RowSource = "SELECT [qryInvoice
Display].InvoiceNumber, [qryInvoice Display].DateScanned FROM
[qryInvoice Display];"

What is a quick and easy method of performing the line below...
Me!CustomerName.Value = "SELECT tblCustomers.CustomerName FROM
tblCustomers WHERE tblCustomers!CustomerNumber = Me!CustomerNumber;"

Obviously it posts the quoted text to the form instead of executing the
query. Said query should only return 1 result, and if it doesn't I
only really care about the first result.

Thanks!

-- John

This seems a thoroughly roundabout way to do this. Why not just set
the ControlSource of the CustomerName textbox to

=DLookUp("[CustomerName]", "tblCustomers", "[CustomerNumbre] = " &
[CustomerNumber])

You certainly shouldn't be storing the custoemr name redundantly in
any case!

John W. Vinson[MVP]
 

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

Back
Top