By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,654 Members | 1,816 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,654 IT Pros & Developers. It's quick & easy.

ComboBox - Controlling Fill

P: 2
Hi there,

I have just started using Access 2003 in the last couple of months and have a couple of problems i would like some help with please for a project i am working on.

PROBLEM 1.
I have a ComboBox (cboSelect) on my form (frmSelectCompany).
I am populating this combobox with [CompanyName] data from my OrderTable.
The problem is if a company has made more than 1 order that company shows up more than once in my combobox, but i only want 1 entry for any CompanyName in the combobox.
Is there any way of limiting the combobox (something like, only putting CompanyName in combobox if it does not already exist)?

PROBLEM 2.
I would like to grab data from a table, but only if a certain field matches a set value.
I was thinking i need to run a loop looking for the value in the table, then if found get that info, but i have no idea how to do this.

Basically i need the calculation below to run in a loop checking a table to see if [SELL PRICE]=[Price]

=IIf([SELL PRICE]=[Price],IIf([SALE QTY] Mod [Quantity]="0",[SALE QTY]/[Quantity],([SALE QTY]\[Quantity])+(([SALE QTY] Mod [Quantity])*[SELL PRICE])),[SELL PRICE]*[SALE QTY])


Any help with either of these problems would be greatly appreciated.

Thanks
Graham
Sep 12 '07 #1
Share this Question
Share on Google+
2 Replies


P: 5
Hi there,

I have just started using Access 2003 in the last couple of months and have a couple of problems i would like some help with please for a project i am working on.

PROBLEM 1.
I have a ComboBox (cboSelect) on my form (frmSelectCompany).
I am populating this combobox with [CompanyName] data from my OrderTable.
The problem is if a company has made more than 1 order that company shows up more than once in my combobox, but i only want 1 entry for any CompanyName in the combobox.
Is there any way of limiting the combobox (something like, only putting CompanyName in combobox if it does not already exist)?

PROBLEM 2.
I would like to grab data from a table, but only if a certain field matches a set value.
I was thinking i need to run a loop looking for the value in the table, then if found get that info, but i have no idea how to do this.

Basically i need the calculation below to run in a loop checking a table to see if [SELL PRICE]=[Price]

=IIf([SELL PRICE]=[Price],IIf([SALE QTY] Mod [Quantity]="0",[SALE QTY]/[Quantity],([SALE QTY]\[Quantity])+(([SALE QTY] Mod [Quantity])*[SELL PRICE])),[SELL PRICE]*[SALE QTY])


Any help with either of these problems would be greatly appreciated.

Thanks
Graham
Hi There,

Not sure on Problem 2, but Problem 1 can be solved by using:

SELECT DISTINCT [CompanyName] FROM [OrderTable].[CompanyName] ORDER BY [CompanyName]

(Use ORDER BY if you want the List to be ordered alphabetically)

Hope this helps!

Cheers
Sep 12 '07 #2

P: 2
Hi There,

Not sure on Problem 2, but Problem 1 can be solved by using:

SELECT DISTINCT [CompanyName] FROM [OrderTable].[CompanyName] ORDER BY [CompanyName]

(Use ORDER BY if you want the List to be ordered alphabetically)

Hope this helps!

Cheers
Thanks for the fast response.
That worked great ....thank you very much.
Sep 12 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.