
Concatenating Fields in sql-string in vba
You probably want a string that looks like:
"SELECT firstname & "" "" & middlename & "" "" & lastname as FullName from
customers"
Note: That the quotes have been doubled around the spaces to be inserted in the
string.
In addition, while this will display James Paul Wodehouse that it will not do
much beyond that.
Quote:
> Hello everyone,
> Could someone help if it is possible to concatenate fields
> in a sql string written in a vba procedure.
> I have combobox which looks up different tables, one is
> from company's and one is from customers. The recordsource
> is decided when i click on a button. The one from
> customers i would like to concatenate, but it doesn't work.
> here's the example:
> on cmdCustomerCompany_click()
> cmbOrder.recordsource = "SELECT companyname from companys"
> on cmbOrder_AfterUpdate()
> cmbOrder.recordsource = "SELECT firstname, middlename,
> lastname from customers"
> What i want is to concatenate firstname and lastname like
> this: Trim(Firstname & " " & middlename) & " " & lastname
> as name