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 and saving to table



 
 
Thread Tools Display Modes
  #1  
Old November 4th, 2009, 09:23 PM posted to microsoft.public.access.forms
Musa via AccessMonster.com
external usenet poster
 
Posts: 35
Default combo box and saving to table

I can select 1 value from a 2 column combo box and save it....no problem. I
can even display the 2nd value of the combo box in a text field. But, is
there a way to select 2 values from the combo box and save column(0) to one
field and column(1) to another field in the same table ?

For Example, ID -- 10 Name --- ABC Company

It saves as: ID Name
10 ABC Company

I know this is against normalization and it would be redundant data, but can
it still be done..?

Thanks

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200911/1

  #2  
Old November 4th, 2009, 10:07 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default combo box and saving to table

On Wed, 04 Nov 2009 21:23:37 GMT, "Musa via AccessMonster.com" u40920@uwe
wrote:

I can select 1 value from a 2 column combo box and save it....no problem. I
can even display the 2nd value of the combo box in a text field. But, is
there a way to select 2 values from the combo box and save column(0) to one
field and column(1) to another field in the same table ?

For Example, ID -- 10 Name --- ABC Company

It saves as: ID Name
10 ABC Company

I know this is against normalization and it would be redundant data, but can
it still be done..?

Thanks


You're right, it's almost certainly a Bad Idea (what if ABC Company gets
bought out and becomes Steele, Robb and Plundre)? but...

Use the AfterUpdate event of the combo to "push" data into a textbox bound to
the other field:

Private Sub cboCompany_AfterUpdate()
Me!CompanyName = Me!cboCompany.Column(1)
End Sub

using the first column as the bound column...
--

John W. Vinson [MVP]
  #3  
Old November 4th, 2009, 10:10 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default combo box and saving to table

On Wed, 04 Nov 2009 21:23:37 GMT, Musa via AccessMonster.com wrote:

I can select 1 value from a 2 column combo box and save it....no problem. I
can even display the 2nd value of the combo box in a text field. But, is
there a way to select 2 values from the combo box and save column(0) to one
field and column(1) to another field in the same table ?

For Example, ID -- 10 Name --- ABC Company

It saves as: ID Name
10 ABC Company

I know this is against normalization and it would be redundant data, but can
it still be done..?

Thanks


1) You're correct....This is redundant data and should not be done.

2) However, if you had some compelling business reason, code the Combo
box AfterUpdate event:
Me.[Name] = Me.ComboName.Column(1)

The field Name should be included on the form.

3) See #1

Note: I hope you do NOT have a field named "Name" in your table.
Name is a reserved keyword and should not be used as a field name.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #4  
Old November 5th, 2009, 09:18 PM posted to microsoft.public.access.forms
Musa via AccessMonster.com
external usenet poster
 
Posts: 35
Default combo box and saving to table

No, field is labelled Name... Thanks for your suggestion.

fredg wrote:
I can select 1 value from a 2 column combo box and save it....no problem. I
can even display the 2nd value of the combo box in a text field. But, is

[quoted text clipped - 10 lines]

Thanks


1) You're correct....This is redundant data and should not be done.

2) However, if you had some compelling business reason, code the Combo
box AfterUpdate event:
Me.[Name] = Me.ComboName.Column(1)

The field Name should be included on the form.

3) See #1

Note: I hope you do NOT have a field named "Name" in your table.
Name is a reserved keyword and should not be used as a field name.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200911/1

 




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 06:48 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.