Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 8th, 2012, 07:41 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
Cannot edit records after sort

Hi,

I have an MS Access 2010 form (Datasheet View) with two fields on it, one is a combo-box which is set as control source of the PK of the table and the other is a description.

I use a combo-box with a query so the ID is used as the key but the company name is shown for selection in the combo.

This works fine until the form is sorted, then none of the records can be changed with a message stating... "This record is not updateable"

Why? and how do I make it updateable after a user has perfomed a sort?

Thanks,

1DMF.
__________________
Free MP3 Dance Music Downloads

To err is human; To really balls things up you need Microsoft!

Reply With Quote
  #2  
Old August 8th, 2012, 09:33 AM
couttsj couttsj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 169 couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 7 m 40 sec
Reputation Power: 43
Not sure if I understand your question correctly, but let me guess. You are using a recordset to populate a combo box, and subsequently changing the "Sorted" property to "True". This will not work. You must use a sorted query to populate the combo box, so that the query and the combo box are in the same order.

J.A. Coutts

Reply With Quote
  #3  
Old August 9th, 2012, 07:57 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
Hi couttsj,

Not sure we are using same terminology. Remember I am talking MS Access!

I am not using a recordset object, if that's what you mean?

I have a form, bound to a table, on the form is a combo box, which is populated by a query so that the text shows column 2 (company name) but the value is bound to column 1 (PK).

However, I think I understand what you are trying to say...

When they sort the combobox , they are not sorting the actual records on the form! They are merley sorting the order of the query bound to the combobox so now the company names / PK is not aligned to the order of the records on the form.

Is that what you are implying?

If so how do you create a form with a combobox and allow the records to be sorted, or can't you?

I have made the combobox load the data in order ASC, but does this mean if the user wanted to flip the order to DESC to get quick access to the bottom of the list , this isn't possible?

Why when the combobox is sorted, it doesn't move the order of the records on the form, after all the combo box is bound to the PK of the table?

It's like it's sorting the order of column 2 (shown as the text) but not column 1 (the PK and value bound)?

How do I make this possible?

Thanks,
1DMF.

Reply With Quote
  #4  
Old August 9th, 2012, 02:00 PM
couttsj couttsj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2011
Posts: 169 couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level)couttsj User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 18 h 7 m 40 sec
Reputation Power: 43
My statements are based upon my experience with VB6, but VB Script and VB for Access basically use the same engine. A combo box uses a simple string for it's contents, with each element in the list separated by a NULL character (Chr$(0)). When you select an element from the list, the index value becomes a pointer into the cached read from the database. When you perform a database update, it requires another trip to the database, so if you change the order the update is not allowed to be performed. This is a limitation of a bound control. The only way I know of to get around the problem is to perform a refresh on the cache by executing a read in the order you desire.

In VB6, I generally steer clear of bound controls, and when I need to perform an update, I generate an SQL statement to execute the task.

J.A. Coutts

Reply With Quote
  #5  
Old August 13th, 2012, 06:07 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
ok, thanks I guess I'll just sort the query bound to the control and they can use filter to find a particular entry.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Cannot edit records after sort

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap