Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30

    for next with edit records

    Hi everybody
    I have a table</SPAN> with 2 fields: product and state.
    I would write 1 only where it appears in fields “state” for the same item

    I woult get B,D,E,G,H in my query !!!!
    what's wrong in this code?




    HELP

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    It's difficult to understand what you need.
    Can you explain in different words?

  3. #3
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    Id like to edit in fields "ConataSoloUno" only that items that have in every record the value 1 so:
    A has not to compare while B yes....like in atthachment!

    I hope I cleared ...sorry for english

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Huh???


  5. #5
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    i forgot the attachments

  6. #6
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Is your problem with Query 'Q_risultato'?

    If so, this is the SQL you have [View -> SQL View]:
    Code:
     
    SELECT DISTINCT Tabella2.articolo
    FROM Tabella2
    WHERE Tabella2.ContaSoloUno = '1';
    The field 'ContaSoloUno' in Tabella2 does not have any '1'.
    So you will not get any rows from your query.

    The field 'stato' has 22 rows with '1' in them.

    If you change your SQL to:
    Code:
     
    SELECT DISTINCT Tabella2.articolo
    FROM Tabella2
    WHERE Tabella2.stato = '1';
    . . . you will get all rows that have a 1 in them [including A, C, F . . .].

    If you want only 'articolo' that do not have any '0' then you can create a query and put this SQL in there:
    Code:
     
    SELECT distinct Tabella2.articolo, Tabella2.stato
    FROM Tabella2
    WHERE Tabella2.articolo not in
    (SELECT distinct Tabella2.articolo from Tabella2 where Tabella2.stato = '0') ;
    OR

    Open Q_risultato
    Click View -> SQL View
    Paste this in there:
    Code:
     
    SELECT distinct Tabella2.articolo, Tabella2.stato
    FROM Tabella2
    WHERE Tabella2.articolo not in
    (SELECT distinct Tabella2.articolo from Tabella2 where Tabella2.stato = '0') ;
    I hope this helps!!

    Mark it solved if your problem is fixed.

  7. #7
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    thanks for answer but i know that rst.fields(ContaSoloUno) is empty...i where i would write something like "x" or "1" or somethingelse...
    the problem is not in my query: just only to test the result of my routine in button("for next 1")!
    My routine seems works but seems olso not evaluate the first record of all product
    My select distinc of product (A,B,C...) is right when it shows only B,D,E,G,H !

    please help me

  8. #8
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    please look know "tabella2"

  9. #9
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I think I understand what you are saying.

    Why do you need a 1 in 'ContaSoloUno'?
    What is the purpose for that?

  10. #10
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    the aim is to identify those products (A,B,C....) to eliminate but every one
    has several variants....to simplify i don't insert another fields with those variants....
    when one product has all variants to 1 i have to select and report to my Systems Engineer wiht a view to eliminate

  11. #11
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I'm not sure if this helps, but you can try it.
    It gives you [I think] what you need.

    Code:
     
    SELECT Tabella2.articolo, Tabella2.stato
    FROM Tabella2
    WHERE Tabella2.articolo not in
    (SELECT distinct Tabella2.articolo from Tabella2 where Tabella2.stato = '0') ;
    I don't know if you can use it for what you need . . .

  12. #12
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    greate...this seems the solutione....i use this
    but at the same time i would use the code...i'm so near the solution:
    my code jump one record for every product....

  13. #13
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I was looking at your code in the 'for next 1' button.

    There is something that may be a problem with your MoveFirst logic . . .
    I will take a loook but it may be a little later as i have work to do . . .

    I will let you know if I figure out why your code is skipping the first one of every articolo . . .

  14. #14
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    Thanks a lot...
    ...

  15. #15
    JJCHCK is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    30
    i can solvewith a trick: adding a record of field to zero (eg: field 1 = null and field 2 = 0)
    But it is not elegant ...or professional

    what can i do ?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. edit combo box
    By slimjen in forum Forms
    Replies: 1
    Last Post: 10-20-2011, 09:52 AM
  2. Replies: 3
    Last Post: 08-23-2011, 04:35 PM
  3. Edit user name
    By accessnewb in forum Programming
    Replies: 25
    Last Post: 08-04-2011, 02:52 PM
  4. edit combobox
    By nako in forum Database Design
    Replies: 1
    Last Post: 06-23-2010, 05:56 AM
  5. Form not letting me edit records
    By bbylls in forum Forms
    Replies: 3
    Last Post: 12-16-2009, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums