Solved

update not working in filtered subform

Posted on 2013-06-10
6
271 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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now