Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 05-11-2018, 11:51 AM   #1
kobiashi
Newly Registered User
 
Join Date: May 2018
Posts: 65
Thanks: 10
Thanked 0 Times in 0 Posts
kobiashi is on a distinguished road
form is saving id not name

I have created a form to create new users, when you press save, it works, save all the details in the query, however i have created a couple of combo boxes, and set them like

bound column 1
column count 2
column width 0";1"


but when i view the query, the form has saved the id and not the name fro the combo boxes, i cant seem to find whats the issue

kobiashi is offline   Reply With Quote
Old 05-11-2018, 11:57 AM   #2
ridders
Part time moderator
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 5,811
Thanks: 79
Thanked 1,430 Times in 1,335 Posts
ridders is just really nice ridders is just really nice ridders is just really nice ridders is just really nice
Re: form is saving id not name

If the name is in the second column, you need to reference that.
As column numbers are zero based use me.comboboxname.Column(1).

However, you can't do that in a query so use a variable such as strName to grab the value, then use the variable or a function based on that in your query.
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

New example databases:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

-----------------------------------------------------------------------------------
nil illegitimi carborundum est
ridders is offline   Reply With Quote
The Following User Says Thank You to ridders For This Useful Post:
kobiashi (05-11-2018)
Old 05-11-2018, 12:02 PM   #3
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 500
Thanks: 0
Thanked 113 Times in 113 Posts
June7 will become famous soon enough
Re: form is saving id not name

Why would you not save the ID? Isn't it the primary key? If you don't want to save ID then don't include it in the comobobox RowSource.

Why are you running a query to save record? Is form not bound to table?

June7 is offline   Reply With Quote
Old 05-12-2018, 12:34 AM   #4
Gasman
Access newbie
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 2,142
Thanks: 270
Thanked 319 Times in 304 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: form is saving id not name

I believe that is how it is meant to work. You save the key not the description.
You then use that key to get the description back.

That way, if you change the description, you do not have to change any links between tables?

At least that is how I have always done it.
I *always* make the first field the ID/key field, and then have my other columns after that, some of which might not be displayed as well.

HTH

Quote:
Originally Posted by kobiashi View Post
I have created a form to create new users, when you press save, it works, save all the details in the query, however i have created a couple of combo boxes, and set them like

bound column 1
column count 2
column width 0";1"


but when i view the query, the form has saved the id and not the name fro the combo boxes, i cant seem to find whats the issue
__________________
Access novice. Sometimes trying to give something back.
Access 2007
Gasman is offline   Reply With Quote
Old 06-01-2018, 10:19 AM   #5
ColinEssex
Old registered user
 
ColinEssex's Avatar
 
Join Date: Feb 2002
Location: Essex, UK
Posts: 8,014
Thanks: 1
Thanked 21 Times in 20 Posts
ColinEssex will become famous soon enough
Re: form is saving id not name

Why does this thread qualify as "site suggestions"?

Col
__________________
"America is pregnant with promises and anticipation, but is murdered by the hand of the inevitable."
ColinEssex is offline   Reply With Quote
Old 06-01-2018, 10:30 AM   #6
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 500
Thanks: 0
Thanked 113 Times in 113 Posts
June7 will become famous soon enough
Re: form is saving id not name

OP selected wrong forum. A moderator can move thread.
June7 is offline   Reply With Quote
Old 06-01-2018, 11:11 AM   #7
ColinEssex
Old registered user
 
ColinEssex's Avatar
 
Join Date: Feb 2002
Location: Essex, UK
Posts: 8,014
Thanks: 1
Thanked 21 Times in 20 Posts
ColinEssex will become famous soon enough
Re: form is saving id not name

Quote:
Originally Posted by June7 View Post
OP selected wrong forum. A moderator can move thread.
I am aware of that. I have been here since around 1999

The thread however has been here since 11/5. I'm surprised an eagle eye moderator hasn't spotted it, they're very quick to ban people for little reason.

Col

__________________
"America is pregnant with promises and anticipation, but is murdered by the hand of the inevitable."
ColinEssex is offline   Reply With Quote
Old 06-01-2018, 12:05 PM   #8
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 9,295
Thanks: 340
Thanked 748 Times in 714 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: form is saving id not name

Quote:
Originally Posted by ColinEssex View Post
>>> I'm surprised an eagle eye moderator hasn't spotted it, they're very quick to ban people for little reason.

Col <<<
Bring it on Colin - Handbags at Noon!
__________________
Get $20 worth of "Nifty Code" and "Nifty Sample Databases" for free - See what's on offer on this page here:-
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Uncle Gizmo is offline   Reply With Quote
Old 06-01-2018, 02:29 PM   #9
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 31,686
Thanks: 9
Thanked 3,796 Times in 3,739 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: form is saving id not name

Quote:
Originally Posted by June7 View Post
OP selected wrong forum. A moderator can move thread.
Moved to a more appropriate forum.
__________________
Paul
Microsoft Access MVP

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 06-02-2018, 08:44 AM   #10
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 27,246
Thanks: 13
Thanked 1,382 Times in 1,317 Posts
Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light
Re: form is saving id not name

Quote:
but when i view the query, the form has saved the id and not the name fro the combo boxes, i cant seem to find whats the issue
This is not an issue, That is EXACTLY the way it is supposed to work. When creating a relationship from one table to another, you store the PRIMARY KEY of the other table NOT a data field. So in tblOrder, you would store CustomerID NOT customer name or any other piece of data.

When you need to display the customerName on a form, you will usually use a combo but on a report, you would use a query that joins tblOrder to tblCustomer on CustomerID and that allows you to display not only the CustomerName but also his phone number and address if you want to.

I am only commenting because the others equivocated rather than making a simple declarative statement - this is how it is supposed to work. Nothing is wrong.

__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving a Form Keefay78 Forms 2 08-04-2017 01:22 PM
Record Saving Issue regarding Main Form and Sub Form phool4fool Forms 5 12-26-2011 10:35 PM
Close form without saving (form loads dirty) tt1611 Forms 4 06-08-2010 03:24 AM
Keep form from saving wtrimble General 11 03-10-2010 01:41 PM
Form help - disable close form from saving changes/updates to table PRodgers4284 Forms 3 02-26-2009 05:32 AM




All times are GMT -8. The time now is 07:03 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World