Properly using a Select Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

As example: I have a table called "WPS Data" containing the following data
"WPS" and "CE"

WPS CE
1A1457 212287
1A1468 212288
1A1475 212287
1A3212 83830
1A1469 212288

What I want to do on my form is when the WPS is selected from a drop down
list the associated CE is displayed in a COMBO box. I can not know how to
write the SELECT statement.
 
As I understand your situation, this may be simply a matter of changing
ColumnWidth. If your dropdown includes both fields (WPS; CE) and your
ColumnWidths are set to show WPS only:

Me.ThisDropdown.ColumnWidths = ".5 in;0 in"

after the click, just switch the numbers:

Me.ThisDropdown.ColumnWidths = ".5 in;0 in"
 
Here's the code I created for the combo box, which doesn't work.

Select WPS Data.WPS &","& WPS Data. CE
From WPS Data
Order By WPS Data.WPS

The output I want should look like: 1A1457, 212287
 
Here's the code I created for the combo box, which doesn't work.

Select WPS Data.WPS &","& WPS Data. CE
From WPS Data
Order By WPS Data.WPS

The output I want should look like: 1A1457, 212287

Blanks are delimiters in SQL (or in VBA). If you (unwisely, in my
opinion) want to use blanks in tablenames or fieldnames, then you must
- no option - use [square brackets] around the name:

SELECT [WPS Data].[WPS] & ", " & [WPS Data].[CE]
FROM [WPS Data]
ORDER BY [WPS Data].[WPS], [WPS Data].[CE];


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