A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo box values for existing and new records



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2010, 09:01 AM posted to microsoft.public.access.forms
ciruliz
external usenet poster
 
Posts: 5
Default Combo box values for existing and new records

Hello,

I don't really know how to formulate question, so I will try to
explain problem shortly:

I have created small invoicing application in Access 2007 for renting
business - there is table of customers, table of invoices and table of
devices we offer for rent (there is one type of devices, total number
- around 10)

There is form for entering new customers and that form contains combo
box, which is lookup to devices table - so user can pick one of
devices.
Everything works so far.

I wanted to introduce new feature - when adding new customer, user can
choose only from those devices which are not rented away. So I created
subquery to limit values of combo box.

Query looks like this:

SELECT Koncentratori.ID, Koncentratori.AccountingNumber
FROM Koncentratori
WHERE (((Koncentratori.ID) Not In (SELECT customers.ConcentratorID
FROM customers WHERE (((customers.agreementActive)=Yes)); )))
ORDER BY Koncentratori.AccountingNumber;

Koncentratori (Concentrators) is the mentioned table of devices, rest
should be obvious.

So far so good.
But here comes the problem - after using this subquery, new record can
be added nicely and combo box contains only those devices, which are
not rented away. However for existing customers combo box does not
show current value - as it is in conflict with that subquery.

I am not sure how to overcome this problem, thanks for any advice!

Br,
Andis






  #2  
Old May 18th, 2010, 12:18 PM posted to microsoft.public.access.forms
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Combo box values for existing and new records

One way would be to create a text box on your form which is bound to the
devices field. This field is used to show the currently selected device.
Change your combo box to an unbound combo box so that it can represent
available devices. When you then make a selection from the combo box, assign
it to the new field on the form.

"ciruliz" wrote:

Hello,

I don't really know how to formulate question, so I will try to
explain problem shortly:

I have created small invoicing application in Access 2007 for renting
business - there is table of customers, table of invoices and table of
devices we offer for rent (there is one type of devices, total number
- around 10)

There is form for entering new customers and that form contains combo
box, which is lookup to devices table - so user can pick one of
devices.
Everything works so far.

I wanted to introduce new feature - when adding new customer, user can
choose only from those devices which are not rented away. So I created
subquery to limit values of combo box.

Query looks like this:

SELECT Koncentratori.ID, Koncentratori.AccountingNumber
FROM Koncentratori
WHERE (((Koncentratori.ID) Not In (SELECT customers.ConcentratorID
FROM customers WHERE (((customers.agreementActive)=Yes)); )))
ORDER BY Koncentratori.AccountingNumber;

Koncentratori (Concentrators) is the mentioned table of devices, rest
should be obvious.

So far so good.
But here comes the problem - after using this subquery, new record can
be added nicely and combo box contains only those devices, which are
not rented away. However for existing customers combo box does not
show current value - as it is in conflict with that subquery.

I am not sure how to overcome this problem, thanks for any advice!

Br,
Andis






.

  #3  
Old May 18th, 2010, 12:38 PM posted to microsoft.public.access.forms
ciruliz
external usenet poster
 
Posts: 5
Default Combo box values for existing and new records

Hi,

This is also a good solution, but it requires additional UI element on
the form, which I don't like.

Currently I received other suggestion, to use onLoad or similar event
and change properties for that combo box:

If Me.NewRecord Then
Me.cmbComboName.ControlSource = 'something
Else
Me.cmbComboName.ControlSource = 'something else
End If

And it seems to be solving my problem, although I am not sure, if it's
the most effecient solution.

Rgs,
A.




On May 18, 2:18*pm, RonaldoOneNil
wrote:
One way would be to create a text box on your form which is bound to the
devices field. This field is used to show the currently selected device.
Change your combo box to an unbound combo box so that it can represent
available devices. When you then make a selection from the combo box, assign
it to the new field on the form.



"ciruliz" wrote:
Hello,


I don't really know how to formulate question, so I will try to
explain problem shortly:


I have created small invoicing application in Access 2007 for renting
business - there is table of customers, table of invoices and table of
devices we offer for rent (there is one type of devices, total number
- around 10)


There is form for entering new customers and that form contains combo
box, which is lookup to devices table - so user can pick one of
devices.
Everything works so far.


I wanted to introduce new feature - when adding new customer, user can
choose only from those devices which are not rented away. So I created
subquery to limit values of combo box.


Query looks like this:


SELECT Koncentratori.ID, Koncentratori.AccountingNumber
FROM Koncentratori
WHERE (((Koncentratori.ID) Not In (SELECT customers.ConcentratorID
FROM customers WHERE (((customers.agreementActive)=Yes)); )))
ORDER BY Koncentratori.AccountingNumber;


Koncentratori (Concentrators) is the mentioned table of devices, rest
should be obvious.


So far so good.
But here comes the problem - after using this subquery, new record can
be added nicely and combo box contains only those devices, which are
not rented away. However for existing customers combo box does not
show current value - as it is in conflict with that subquery.


I am not sure how to overcome this problem, thanks for any advice!


Br,
*Andis


.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.