Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

update not working in filtered subform

Posted on 2013-06-10
6
Medium Priority
?
329 Views
Last Modified: 2013-06-26
May a help, what i`m doing wrong, in the attached sample, in the FrmUpdateStructure form
i choose to filter:
storage name=1
shelfFrom=1
shelfUntil=5
cellName=1
i got 5 rows.
now choose in the cmocondition=Not counted, and click "CmdUpdate"
i doesn`t update only the filtered row, it updates all the rows !
it also changes the cmocondition value "Not Suitable" to a "Not counted"

also i`ll appertiate haven better way to filter rows from combobox than my way in doing it.
SmartStorage.accdb
0
Comment
Question by:drtopserv
  • 4
  • 2
6 Comments
 
LVL 12

Expert Comment

by:pdebaets
ID: 39236154
Try this:

Dim rst0 As DAO.Recordset,  Qty As Long, C As Long
Set rst0 = Me!sfmList.Form.RecordsetClone
rst0.MoveFirst
Do While Not rst0.EOF
    rst0.Edit
    rst0!moneycondition = CStr(Nz(Me.cmoCondition.Value, 0))
    rst0.Update
    rst0.MoveNext
Loop

Open in new window

0
 

Author Comment

by:drtopserv
ID: 39236762
Sorry i tied it, didn`t help out:{
0
 

Author Comment

by:drtopserv
ID: 39236771
I think i figure out where is the problem.
the rst0!moneycondition field in the subform is a field from a another table (multitable), means i should have to replace it with conditionID from tblcell . but the problem is that this field is number, i need to put the unbound combobox "Me.cmoCondition" to show me a text values and to insert into the conditionID field a number (means to display a text in the interface but to save a number in the table field)
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:drtopserv
ID: 39236834
wow, i think i have found the solution,
i think i should have to write :

rst0!moneycondition = CStr(Nz(Me.cmoCondition.column(0), 0))  instead of :

rst0!moneycondition = CStr(Nz(Me.cmoCondition.Value, 0))
0
 
LVL 12

Accepted Solution

by:
pdebaets earned 2000 total points
ID: 39238476
I had success with the code I posted above. When you tried it, what problem did you have?
0
 

Author Closing Comment

by:drtopserv
ID: 39277652
Anyway, even it was to add little fix, still your code help out..
thnx man:}
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
What we learned in Webroot's webinar on multi-vector protection.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question