473,471 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Assiging the primary value back to Text Box

46 New Member
Hi All
I have a list box in a form with three columns
1.ID
2.Name
3.Age
In the same form i have three text boxes corresponding for the above columns.
The form record source property is set to the Table.ID field is autonumber.
Now i am facing a error.When i select one row in a list box ,i want to assign the values in the list box row back to text box for updation purpose.Now Name and age i am able to assign but for ID it is showing the error message
"You cant assign a value to this object".Can any one advise me pls
The code in my listview dbl click event is as below
Expand|Select|Wrap|Line Numbers
  1. With Me.List15
  2.       For i = 0 To .ListCount - 1
  3.          If .Selected(i) = True Then
  4.              Me.Fare_Line_Id.Value = .Column(0, i)---error comes here.
  5.              Me.Name.Value = .Column(1, i)
  6.              Me.Age.Value = .Column(2, i)
  7.          End If
  8.     Next i
  9. End With
Thanks in advance
Feb 27 '08 #1
9 1969
FishVal
2,653 Recognized Expert Specialist
Hi, ramdil.

Are you sure [Fare_Line_Id] control has Value property and it is not bound to any read-only table field?

Kind regards,
Fish
Feb 27 '08 #2
Scott Price
1,384 Recognized Expert Top Contributor
Autonumber's are not user updateable, nor should they be! Access's autonumber data type was not created for user interaction, only for uniquely identifying each record in a table.

If you have a real requirement for a primary key that IS user updateable, you'll need to write some code that creates the automatically incrementing key value (for which there are several threads on this site).

Other than a business requirement (such as the bosses saying you need to have each record identified with an alphanumeric code such as TBL0001, or a hidden date such as 02280800001) I can't see the need for you to change the ID field.

Regards,
Scott
Feb 27 '08 #3
NeoPa
32,556 Recognized Expert Moderator MVP
By the way, are you intending to create a new record with this or update an existing one?
Your code seems to be attempting the latter.
Feb 28 '08 #4
ramdil
46 New Member
Hi
Thanks for the reply,I am trying to update the record..




By the way, are you intending to create a new record with this or update an existing one?
Your code seems to be attempting the latter.
Feb 29 '08 #5
ramdil
46 New Member
Hi
Thanks for the reply,Yes ,It is bound to datatype autonumber


Hi, ramdil.

Are you sure [Fare_Line_Id] control has Value property and it is not bound to any read-only table field?

Kind regards,
Fish
Feb 29 '08 #6
ramdil
46 New Member
Hi
Thanks for the reply,My aim was to update the record with selected primary key id..




Autonumber's are not user updateable, nor should they be! Access's autonumber data type was not created for user interaction, only for uniquely identifying each record in a table.

If you have a real requirement for a primary key that IS user updateable, you'll need to write some code that creates the automatically incrementing key value (for which there are several threads on this site).

Other than a business requirement (such as the bosses saying you need to have each record identified with an alphanumeric code such as TBL0001, or a hidden date such as 02280800001) I can't see the need for you to change the ID field.

Regards,
Scott
Feb 29 '08 #7
NeoPa
32,556 Recognized Expert Moderator MVP
Hi
Thanks for the reply,I am trying to update the record..
This logic doesn't make much sense then.
Why would you update the (same) current record with multiple values? Each successive one would overwrite the previous one.
Feb 29 '08 #8
ramdil
46 New Member
Hi Thanks for the valid point

I have changed the logic and now i am updating the records based on the unique value and is working fine.
This logic doesn't make much sense then.
Why would you update the (same) current record with multiple vales? Each successive one would overwrite the previous one.
Mar 10 '08 #9
NeoPa
32,556 Recognized Expert Moderator MVP
Oh good. I like it best when you find your own answers :) It indicates you're learning from the issues.

Congratulations :)
Mar 10 '08 #10

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

Similar topics

2
by: Andrew Grandison | last post by:
We are converting a legacy visual foxpro system to use a SQL back-end. A number of (existing DBF) tables currently have a zero-filled primary key eg. '000255' which is just an auto-incrementing...
4
by: Megan | last post by:
Hi- I need some help/ advise on how to code unique numbers for the primary keys of my 2 tables. I inherited a database that covers information about Hearings and Rulings. Information about the...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
2
by: stranger | last post by:
My database is set up so people can input parts orders. Sometimes they order the same parts on a monthly basis. I want to be able to duplicate past parts orders and have it pasted in with a new...
4
by: Newbie | last post by:
hello! i'm new to sql server and having some problem getting the primary key or index (Reference column). opening up the design table, the primary key or index column has an identity seed number...
5
by: Hennie | last post by:
When trying to update a record in an editable datagrid I ran into a few problems. My update procedure is just not working. Can someone please have a look at my code and see what am I doing wrong....
9
by: Geoff | last post by:
Hi I was wondering if anybody could advice me on the following scenario: Suppose I have two data tables A and B respectively. Table B contains a foreign key to a primary key in A. If I add...
2
by: VictorS | last post by:
Hello everybody! I’ve inherited a moderate size Employee database. Main Employees table has a SSN as a primary key, but it is a “Text” data type. I’m now told to delete social security numbers due...
2
jmoudy77
by: jmoudy77 | last post by:
Hi, I've got a database with front-ends at multiple locations that pull from a primary back-end over a satellite network. Each time a front-end closes it triggers a back-up utility that creates a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.