Solved

update not working in filtered subform

Posted on 2013-06-10
6
306 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

820 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