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: 47
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
Newbee moderator
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 5,266
Thanks: 77
Thanked 1,283 Times in 1,199 Posts
ridders is a jewel in the rough ridders is a jewel in the rough ridders is a jewel in the rough ridders is a jewel in the rough
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.
__________________
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.


If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left and leave a comment.

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.
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: 279
Thanks: 0
Thanked 62 Times in 62 Posts
June7 is on a distinguished road
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: 1,913
Thanks: 250
Thanked 269 Times in 254 Posts
Gasman will become famous soon enough Gasman will become famous soon enough
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: 7,994
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: 279
Thanks: 0
Thanked 62 Times in 62 Posts
June7 is on a distinguished road
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: 7,994
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,131
Thanks: 317
Thanked 723 Times in 689 Posts
Uncle Gizmo has a spectacular aura about Uncle Gizmo has a spectacular aura about Uncle Gizmo has a spectacular aura about
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!
__________________
Tony Hine - My Aspiration --- Finding a better way of Explaining ---
From this YouTube:-

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Uncle Gizmo is online now   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,458
Thanks: 9
Thanked 3,756 Times in 3,699 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,094
Thanks: 13
Thanked 1,340 Times in 1,279 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
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 03:09 AM.


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