Updating a check box in Access

Is it possible? It must be. I have a table in MS Access that has three columns that are check boxes for contacted once, contacted twice, and contacted 3x's.
I already know that if a check box is selected it is equal to "1" and if not selected it is equal to "0"
I want to run a program thru to say if 1stcontact equals "0" it has to updated by insert a check, else if 2ndcontact equals "0" it updates, and so on.
This is what I've come up with. Does anyone know what's wrong?
               String contact1Xs = ""; String contact2Xs = "";
               String contact3Xs = "";
               try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
               String url2 = "jdbc:odbc:d1b";
          java.sql.Connection c2 = DriverManager.getConnection(url2,"admin", "rjdemo");
          java.sql.Statement st2 = c2.createStatement();
               java.sql.ResultSet rs2 = st2.executeQuery("select * from testcontacted");
     java.sql.ResultSetMetaData md2 = rs2.getMetaData();
               while(rs2.next())
               { contact1Xs = rs2.getString(10); contact2Xs = rs2.getString(12); contact3Xs = rs2.getString(14);
               if (contact1Xs.equals("0"))
                         st2.executeUpdate("UPDATE testcontacted SET 1stcontact = 1");
                    else if (contact2Xs.equals("0"))
                         st2.executeUpdate("UPDATE testcontacted SET 2ndcontact = 1");
                    else if (contact3Xs.equals("0"))
                         st2.executeUpdate("UPDATE testcontacted SET 3rdcontact = 1");
                    else
                         System.out.println("Row " + rs2.getRow() + " has been contacted 3 Xs");
          } //closes while rs.next()
                    rs2.close();
               }     //closes try block
               catch(Exception e)
               e.printStackTrace();

If you already have a primary key, then use this code
import java.sql.*;
import java.util.*;
class AccessCheck {
     public static void main(String h[]) {
          String contact1Xs = "";
          String contact2Xs = "";
          String contact3Xs = "";
          int primeColumn="";
          try {
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
               String url2 = "jdbc:odbc:testdb";
               java.sql.Connection c2 = DriverManager.getConnection(url2,"", "");
               java.sql.Statement st2 = c2.createStatement();
               java.sql.ResultSet rs2 = st2.executeQuery("select * from testcontacted");
               java.sql.ResultSetMetaData md2 = rs2.getMetaData();
               Vector batch = new Vector();
               int rowNum=0;
               while(rs2.next()) {
                    primeColumn= Integer.parseInt(rs2.getString("primary_column"));
                    contact1Xs = rs2.getString(1);
                    contact2Xs = rs2.getString(2);
                    contact3Xs = rs2.getString(3);
                    if (contact1Xs.equals("0")) {
                         batch.add("update table testcontacted set 1stcontact=1 where prime_column="+primeColumn);
                    } else if (contact2Xs.equals("0")) {
                         batch.add("update table testcontacted set 2ndcontact=1 where prime_column="+primeColumn);
                    } else if (contact3Xs.equals("0")) {
                         batch.add("update table testcontacted set 3rdcontact=1 where prime_column="+primeColumn);
                    } else {
                         rowNum++;
                         System.out.println("Row " + rs2.getRow() + " has been contacted 3 Xs");
               } //closes while rs.next()
               for(int batchCount=0;batchCount<batch.size();batchCount++)
                    st2.executeUpdate((String)batch.elementAt(batchCount));
               st2.close();
               c2.close();
               System.out.println("Completed.....");
          } catch(Exception e) {
               e.printStackTrace();
}Please change the insert query in the previous response to insert all other values (columns).
Hope this helps too.
Sudha

Similar Messages

  • BEX web designer 7.0, update roll time update with check box?

    guys this is what i am trying to do?
    i have few reports on some cubes,
    i have created some queries on the cubes,
    created a web template and in item i have placed each query with data load time, so i get the last time the data was updated.
    now what i want to do is.. if the data was laoaded yesterday, i want the web template to check if it was loaded today or not, if yes then put a check box in the web template that would be clicked? if not then it would be unchcked with the last time loaded.
    in the query designer , i only have the time status of the last query updated, the query is suppose to update everyday? but it can also be updated everyday twice, as once in the morning and once in the evening.
    so how do i go and create , an if statement that if date 1(yesterday) is not equal  to date 2(today), then have the check box in the web template be checked?
    can i create a conditon or exception.. any ideas would be helpful i am stuck...

    i start using visual composer.

  • Problem with check box in ALV Grid Display

    I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database,  my question is after perform update operation check box should be clear.
    Kindly help me!!!!

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

  • Disable the check box

    Hi All,
    I have a requirement in which based on the profile option user should be able to change the value of check box.
    Name of profile option is acces_level. In this user level profile option two values are possible 'User' or 'Administrator' and there are two check boxes cb1 and cb2. I want that cb2 should be available only to the user, those have value of profile option as 'Administrator'. cb1 will be available for all.
    Thanks in advance.
    Looking forward onn this.

    I used now
    declare
    nProp varchar2(20);
    BEGIN
    nProp := fnd_profile.value('ACCESS_FOR_WISPER_PART_RESEND');
    if nProp = 'ADMINISTRATOR' then
    set_item_property('XXINFC_WISPER_PARTS_MASTER.INSPECTION_FLAG', enabled, 'property_true');
    else
    set_item_property('XXINFC_WISPER_PARTS_MASTER.INSPECTION_FLAG', enabled, 'property_false');
    end if;
    END;
    I am writing this in WHEN-NEW-FORM-INSTANCE trigger at data block level.
    Now there is only one problem. In the form I am displaying 15 values. All 15 values have there respective check boxes. Now except first check box all other check boxes are disabled. Do you have any clue why the first cbox is not disabled. There is one more thing when profile option is set with value USER (Now it should allow to update the check box) then If I change any cbox then it does not allow me to change any other check box.
    Looking forward for you reply.

  • FRM-40501 Error When Attempting To Change Check Box Value

    I am getting a FRM-40501 error when attempting to update/change a check box value. There are a few factors in my form setup that could be the problem, I will list them below:
    My initial problem was that my INSERT statement would not trigger to fire (based on an IF statement) when my check box value was not initially set to the value of 'Y', even though the initial value was set to 'Y' in the property palette (value when checked was set to 'Y' and value when unchecked was set to 'N'). So, to remedy this I placed a specific literal select of 'Y' and aliased it back to the name of my check box name in the data block query, like: SELECT 'Y' CB_SELECT_SCHOOL FROM user_schools. Then I changed the check box to a database item (value to Yes when it was No before my "SQL select cheat" in the data block query). This made the initial value 'Y' and satisfied my IF statement before my INSERT statement in my trigger. However, now I can not update the check box item.
    Does anyone know a better way to satisfy the initial value of my check box to 'Y', even though in the initial value parameter for my checkbox is set to 'Y' and forms is not really setting the initial value (when the check box is not set to a database item)?
    Thanks in advance.
    Kyle

    I have fixed my issue.
    I have reverted the check box to not be a database item, removed the "SQL cheat" of selecting 'Y' aliasing my checkbox name in the datablock SQL, and changed the initial value of 'N' in the check box property palette. This will force a change by the user making the check box value of 'Y', satifying my insert when-button-pressed trigger to fire and update the selected row.

  • Task check box shaded dark grey

    This is a very bizarre issue I just noticed after the recent December updates to SharePoint 2013. We have Project Server 2013 running in our deployment of SharePoint 2013 and after this last set of updates for SharePoint 2013 all of the task check boxes
    in a project are a solid dark grey. When you click on one of the boxes to mark the task as completed, it just has a small amount of movement in the check box and remains a solid dark grey. Before the update the check boxes were normal and white and when you
    complete a task it would show the check mark in the box.
    Does anybody know why my task check boxes are like this, or has anybody seen this before? Not a show stopper, but a bit annoying.
    Thank you,
    D. Graf

    I've got the exact same issue, no idea what the cause is and this is the only thing I could find when searching for a solution.
    Did you manage to solve it?

  • Access 2010 - If Then Else Statement to display text within text box upon Check Box True/False condition

    I have a form called myForm. On this form is a check box called myCheckBox. I also have a text box labeled myTextBox. I have assigned a macro, myMacro, to run upon selection/click of myCheckBox. The macro is an If statement which determines if myCheckBox
    is checked or not checked and spits out a value, "Yes" or "No" for example, into the text box.
    I am not able to get text to display into the text box although I am not receiving any errors when I run the macro. This may be a fault in my logic and would like help resolving where the problem lies. I am fairly new to Access so this could be something
    simple.
    My code is as follows:
    If Forms!myForm =  True Then
      Forms!myForm!myTextBox.Value = "Yes!"
    ElseIf Forms!myForm = False Then
      Forms!myForm!myTextBox.Value = "No!"
    Else
      Forms!myForm!myTextBox.Value = " / ERROR / " 
    End if
    Thanks!

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, the issue is more related to coding/programing, you'd better post your question to the MSDN forum for Access
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=accessdev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support

  • Since updating to Firefox 3.6.15, I can no longer print coupons from SmartSource. The error message is that Java is not detected. The check box is longer showing in the Options/Content of this version of Firefox, so I can not enable it.

    # Question
    Since updating to Firefox 3.6.15, I can no longer print coupons from SmartSource. The error message is that Java is not detected. The check box is longer showing in the Options/Content of this version of Firefox, so I can not enable it.

    Same PC as I used to post the question. When I go to the "plug in check" page, it shows I am up to date and it is not disabled.
    Java(TM) Platform SE 6 U24
    Next Generation Java Plug-in 1.6.0_24 for Mozilla browsers 1.6.0.24

  • Info record update check box in Po

    Hi,
    We are working in ECC 6.0 envirnmoment and our project is trying to explore the functionality of PIR. The problem is I am not able to see info record update check box in the material data tab of the PO. I did not get any configuration in SPRO to make that field visible/ invisible. Please help me to for making this field visible at the time of PO creation in transcaction code me21n.

    HI Muttu,
    SPRO>>MM>>Purchasing >> Purchase order>>Define Screen Layout at Document Level>> NBF>> Administrative data,
    in that u can make display or optional or required entry
    Check once again in ur Purchase order it may be display mode in ur PO
    Regards
    Pramod

  • Accessing check box values in to WF

    Hi guys,
    i am looping through a list to create simple table with some check boxes ( <FieldLoop for='loopvar' in='variables.apps[*]'> ). i have specified checkbox field name - as "loopvar"
    <Field name='loopvar'>
    <Display class='Checkbox'>
    <Property name='label'>
    <ref>loopvar</ref>
    </Property>
    </Display>
    </Field>
    how shud i pull / get the list of chek boxes selected on the userform in to WF? will the form return a list? and how shud be the name field syntax shud i use a ":varibales."? im confused. please guide me with the best practice to declare and access check box values
    Edited by: tea_or_kapi on Nov 20, 2009 10:44 PM

    Hi Raju,
    Try this.  Create another dataprovider within your web template?  This new dataprovider refers to a similar query, but this query definition should restrict values CG1, CG2, CG3 and CG4.  Assign this dataprovider to your checkbox.  Then make sure the properties of the checkbox affect all other dataproviders.
    Also, if this list is static, you could create an HTML checkbox object coding the options (cg1, cg2, cg3, and cg4) programmatically.  Then add javascript code to produce the proper filtering based on the users' selections.
    Let me know what happens.
    Larry

  • To create a check box list having values updated as on click

    hi i am working on jDeveloper
    My scenario is like this
    Select Payee : # All
    # Stamp duty 21212
    # Loan 12122
    Total -- ______
    *# represent check box* so if i click on any of the check box its values need to dynamically updated in the Total .
    I have used this code
    <af:selectOneChoice> to list the items but i cant be able to dynamically update the Total. And also only variable are displaying and i need to show the values also.
    So anyone can help me in this plz.

    No easy answer, so maybe you'll first have to know Captivate a little bit better?
    There is a checkboxes interaction, that can be used to manually check off. But if you want that to trigger an animation, you'll be needing an action to apply an effect or to insert an animation.
    Is this really that important, nothing else more urgent? The TOC provides you already with a way to have visited slides automatically being checked with a tick mark.
    Lilybiri

  • Enable to select a check box in ALV while accessing it through portal

    Hi All,
    Currently I have given a link on portal to run a transaction code. The output of the program is ALV report, where user any select the check boxes.
    Now when I try to select a check box, it is not getting selected. I click on the checkbox, the tick appear and then the screen refreshes itself and the tick goes off. This is happening only when accessing it through portal. If i run the program in R/3 directly, I am able to select the check box.
    Please advice on this.
    Thanks
    Namit

    Reported to SAP for the same.

  • Multiple check boxes in an update form using php

    I have a database of the membership of a club. One field in the database is input by checking multiple check boxes. When the insert member record is submitted and multiple check boxes are selected, the information becomes an array of text separated by commas. When the user goes back to the update form, the check boxes are not showing checked in the appropriate fields. Please go to my test site where you will be able to see the code that I have created so far: http://www.usreboot.com/phphelp.php. You will find the php code for the update form in a pdf file located there. You will need a user name and password to look at the update record page. Here you go: user name: wyane, password: wayne. I have submitted this request in the past and have not found success so far. Thanks for your help, Wayne Rowlands

    I am so close. If a member has only one check box checked. I get the check box checked in the update form. Here is the updated code:
    If the member has a number of check boxes checked, none of the check boxes are checked. I am so close. Maybe you can figure out what I am missing.  Thanks, Wayne

  • Multiple check boxes in an update form

    I have a database of the membership of a club. One field in the database is input by checking multiple check boxes. When the insert member record is submitted and multiple check boxes are selected, the information becomes an array of text separated by commas. When the user goes back to the update form, the check boxes are not showing checked in the appropriate fields. Please go to my test site where you will be able to see the code that I have created so far: http://www.usreboot.com/phphelp.php. You will need a user name and password to look at the update record page. Here you go: user name: wyane, password: wayne. I have submitted this request in the past and have not found success so far. Thanks for your help, Wayne Rowlands

    Thanks for getting back with me. I do have two tables. One table is the "members" table where all the information for the members is stored. One of the columns is "currentClubPositions". The database has another table which is "positions" which has the list for the positions that a member of the club could serve on. Members of the club may be serving on a number of positions at once, therefore the check boxes. Also, the club is adding and deleting positions over time, so I wanted an easy way to add them and delete them without having to go into phpmyadmin to do this. I have created a form that updates the "positions" table. The check boxes that show up in the insert member record and update member record are dynamic so that when the table "positions" changes, the forms change dynamically as do the queries to sort the database change dynamicaly. When the check boxes are entered, I use the implode function to make the values an array of text separated by commas and that value is inserted in one field of the members table named "currentClubPosition". I am all ears to hear a better way. Take a look at the web pages (see the original post) that I have created and you will see how all this ties together. Thanks, Wayne Rowlands

  • Update order user status based on a custom check box value in web ui

    Hi Experts,
    I have a requirement to Update the  user status based on a custom check box value in web ui.
    This is needed at the followup for a SR, the component is BT116H_SRVO, Details View.
    I created a value node with 4 checkboxes, based on the check box value, the corresponding user status
    need to be updated.
    How can I reach to the order save functionality of SAP in EH_ONSAVE method, so that syatem can capture my check box value, along with other screen fields, and append the status parameter in Order maintain?
    or do I have to call order maintain in even handler for checkbox, which will affect performance .....
    Pls help.
    Regards,
    Lakshmi

    Hi,
    In your event handler you can use bol entity corresponding to status BTStatusH and change the user status.
    Best regards,
    Caíque Escaler

Maybe you are looking for

  • Ms-6570 Radeon 9800 pro keeps freezing up

    hello I just purchased at radeon 9800 pro and everytime i play a game the screen freezes up at random and the sound starts to echo.  I know this is a video card problem as my gf4 works fine in my system.  I have read most of the posts in this forum a

  • How to Declare Arrays in bpel and use them as acollection

    Hi, I Am new to Bpel, I had created an empty Bpel Process and configured file adapter to a directory, In my text file i have 3 records with four columns, each column seperated by ',' and each record seperated by "EOL(end of line)", Below is the xsd f

  • Updating iPod launches Windows Explorer - how to stop?

    Every time I update my iPod, Windows XP launches a new Explorer window for the iPod (labeled as G:). How do I stop this automatic behavior? I don't have the iPod enabled for use as a drive, so my guess is that this is a Windows XP setting. Any ideas?

  • Since recent update, Adobe Flash Player no longer works.

    Help please.  Recently I received notification of updated version, latest version of Adobe Flash Player for my MacBook Pro with OS X version 10.6.8. Flash Player was working and active prior to this update.  Since downloading the update, anything req

  • How to setup stack files on desktop

    I just got my first macpro and accidently blew away my stacked files that were located on bottom rgt corner of screen. could not find in trash so do not know where it went ... just know that while dragging this stack across screen and released it I s