Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Cheryl R is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    36
    Option group control is for all of the buttons in the group to populate one field with several option choices.


    For example, If I make a hat and it can be red, white, or blue, I would use an option group and chose one of these for each hat. You would still have to have a field to populate on the main form.

    You are wanting each button to populate several different fields. You will need to name each button and add code to the On Click event of each one.
    This is done on the properties sheet (found on the Design Tab) on the Event tab on the On Click Event. Click on the ... at the end and select the builder. Choose Code. This will take you to your VBA screen where you will enter the code for each button. You will have to do this for every button on your form.

  2. #17
    mcalpi18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    12
    Yes this is what I am struggling with... Do you know what the code would be for the button to populate the table? Below is the code I have been trying but have not had any luck yet..

    Private Sub Command24_Click()
    Master.Entry_Date.Value = Date() - I would like this to be the current date
    Master.Plant_Area = "URS" - I would like my table's (Master) Field (Plant_Area) to be given the text "URS"
    Master.Station = 9 - I would like my table's field (Station) to be given the value of "9".
    Master.robot = 1
    Master.weld = 1
    Master.Score = 2
    End Sub

  3. #18
    Cheryl R is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    36
    Again, you need fields on a form to populate the underlying table.
    You can use a wizard to create the form then set the visible property to No for all of these fields. Then add your buttons and on the On Click event, type in Me.EntryDate = Date, etc.
    Also, if you are trying to enter "URS" into a numeric field it will never ever accept the data.

    I know you don't have time to read the entire Access book but you do need to know the basics:
    http://office.microsoft.com/en-us/ac...001112771.aspx

  4. #19
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @Alan, Thanks a lot!

    @mcalpi18
    I think you are going to be drinking through a fire hose, but hang in there with me...

    Basic stuff:
    Tables store data. Period.
    Forms are how you interact with data in tables. You add, edit or delete data or records.
    ALWAYS use form. NEVER allow users to edit data directly in tables.

    Reports are for, well reports. Usually paper printouts.

    Queries
    There are four main types of queries:
    "Select queries" - these select the records you want to display in a form or report
    "Update queries" - these modify (update) data in records
    "Append queries" - these append (insert) new records into tables
    And "Delete queries" - these delete records from tables.

    You want to add new records to tables. So you:
    - can use the query designer, create the append query and save it.
    Copy the following, create a new query, switch to SQL view, paste in the SQL and save the query.
    Code:
    INSERT INTO Master (Entry_Date, Plant_Area, Station, robot, weld, Score) VALUES (Date, "URS", 9, 1, 1, 2);
    Any time you open the query (double click on it) a new line will be added to the table "Master".
    Or you could create a button with one line of code to execute the query.

    Other methods:
    - you could use VBA to execute an append query (in code). It would look like this:
    Code:
    Private Sub Command11_Click()  
    
       CurrentDb.Execute "INSERT INTO Master (Entry_Date, Plant_Area, Station, robot, weld, Score) VALUES (Date, 'URS', 9, 1, 1, 2);"
    
    End Sub
    - you could use VBA to open a recordset and add a record:
    Code:
    Private Sub Command11_Click()
       Dim r As DAO.Recordset
    
       Set r = CurrentDb.OpenRecordset("Master")
    
       r.AddNew
       r!Entry_Date = Date
       r!Plant_Area = "URS"
       r!Station = 9
       r!robot = 1
       r!weld = 1
       r!Score = 2
       r.Update
    
       r.Close
       Set r = Nothing
    
    End Sub
    I don't think these last two methods are very useful because the data, with the exception of the date, will never change unless you edit the code or the saved query.
    If you have text boxes on the form you could enter different data for Entry_Date, Plant_Area, Station, robot, weld & Score, then you would only need one button to add any data for any part of the plant.


    The easiest method would be to use a bound form.

    Are you drowning yet??


    If you have more questions, post back.

    If you could post a picture of the form, your relationships or post your dB, it would help us understand what you are trying to do......

  5. #20
    mcalpi18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    12
    HaHa I have been drowing since I started on this. Thank you very much for all of your feedback I am begining to make some progress!!

    OK So because I want the operator to only be able to record the quality on each weld once I have decided to go with Option group controls.. I figured out how to get the option groups to record all of the data I want on the form when clicked. The problem now is since I want to rate the "Quality" of each weld I have all of the option groups "storing" the recorded data in the "Quality" field. But because they all record the same values for the same field what ever button was pressed last is the only one to show up.

    I need each option group to independently create their own record of which option was selected. I also would like it if a operator accidentaly selected two options inthe same group only the the second selection would be recorded or it would overwrite the 1st selection.

    My overall plan is to have the "Plant_Overview" form come up. You would then select the station you would like to record the data for. This would open up another form (URS_S09_S12) And here you can rate and record the individual welds for each robot.

    Any Ideas on how to make each option group independetly create thier own record and store it in the same field?
    And how to have each option group only record the last option selected?
    Oh I also need to have my Station forms feed my "Master table" so that all of the data is in one spot. - I have'nt gotten far enough yet to try and figure this out.

    Attached is the very basic version of what I am trying to accomplish (the file is to large if I add anything else.)
    Thank you SO much for all of you guidence again!
    It is truly appreciated
    Attached Files Attached Files

  6. #21
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I'll look at it tonight.

  7. #22
    mcalpi18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    12
    Thank you!!! Instead of the option groups feeding into one field I have tried creating 3 fields in the form with names "NoFlash" "FlashL" for Flash <3ft and "FlashG" for Flash > 3ft. and having each toggle button hard coded to these so that when the user clicks the toggle button it updates ONE of the fields "NoFlash", "FlashL" or "FlashG" with a 1. But my problem is if the user then clicks No Flash , and then Flash < 3ft it puts a 1 in both fields. Which leads to contradictory records.

    Thank you Again!!

  8. #23
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    So I finally was able to extract your dB.... Had to install 7-Zip. After I did the Hokey-Pokey, I was able to open the accdb.

    After looking at the two forms, I finally saw the button on the picture. I was really confused for a while. Didn't see any code for the main form - it was an embedded macro.

    I need more info.
    For plant area "URS", how many stations are there per group (button). I believe (working from memory) the button was S9 - S12.
    So there are 4 stations for that button (9, 10, 11, 12)? What about other station groups (buttons)?
    And how many robots per station?
    How many welds are being entered per station per robot?
    For the score, are there the 3 options? "No Flash", "Flash < 3ft" and "Flash > 3ft."? and you want
    1 = "No Flash"
    2 = "Flash < 3ft"
    3 = "Flash > 3ft."


    Can you explain what you want to happen when the button for "URS" "S9 - S12" is pushed?
    What is the sequence you expect to happen?

    There are several ways to do what you want. I just don't want it to be my way.... what happens/the process flow for data entry should be what you envision.

  9. #24
    mcalpi18 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    12
    Thank you very muhc for the help and I apologize for the Zip file.
    So the "Plant Overview" Form is simply a overhead shot of the facility this is for. I would like for the operator to click on the any one the section buttons (S9-S12), (S13-s15) etc.... There will eventually be one of these overtop of the all of the sections.

    Once a section is selected it will dierct you to the screen where there is the red, yellow, and green table. Except there will be approximately 24 tables on this screen (1 for every robot, approximately 6 robots per station and 4 stations for URS_S9-S12). Each robot will do approximately 6 welds so I would like to have a option button for every row and column in every table (~18 option buttons per robot). This way the operator will be able to easily select the weld score (No flash, Flash <3ft, Flash > 3ft).

    I have been experiments with having 3 seperate fields (No Flash, Flash < 3ft, Flash > 3ft) instead of having all of the scores feed into the same field (Score). I tried this because when they all feed into the same field (Score) they would overwrite eachother and whatever the last button selected was would be the only one to display on all of the buttons. In my attempts at this I would simply hard code:
    Overall I need a seperate record for every weld documenting what Plant Area ("URS"), Station ("S09"), Robot ("R01"), and weld was scored and its individual score. Here is the code for my more recent attempts to solve this issue.

    This is for (4) of the welds that Robot 1 does in station 13 in the "URS" system.
    Private Sub Frame105_Click()
    DoCmd.GoToRecord , , acNewRec
    Me.Entry_Date = Date
    Me.Plant_Area = "URS"
    Me.Station = 13
    Me.Robot = 1
    Me.Weld = 1
    End Sub

    Private Sub Frame131_Click()
    DoCmd.GoToRecord , , acNewRec
    Me.Entry_Date = Date
    Me.Plant_Area = "URS"
    Me.Station = 13
    Me.Robot = 1
    Me.Weld = 2
    End Sub

    Private Sub Frame140_Click()
    DoCmd.GoToRecord , , acNewRec
    Me.Entry_Date = Date
    Me.Plant_Area = "URS"
    Me.Station = 13
    Me.Robot = 1
    Me.Weld = 3
    End Sub
    Private Sub Frame154_Click()
    DoCmd.GoToRecord , , acNewRec
    Me.Entry_Date = Date
    Me.Plant_Area = "URS"
    Me.Station = 13
    Me.Robot = 1
    Me.Weld = 4
    End Sub
    Private Sub Option108_GotFocus()
    Me.NoFlash = 1
    Me.FlashL = 0
    Me.FlashG = 0
    End Sub
    Private Sub Option110_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 1
    Me.FlashG = 0
    End Sub
    Private Sub Option112_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 0
    Me.FlashG = 1
    End Sub
    Private Sub Option134_GotFocus()
    Me.NoFlash = 1
    Me.FlashL = 0
    Me.FlashG = 0
    End Sub
    Private Sub Option136_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 1
    Me.FlashG = 0
    End Sub
    Private Sub Option138_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 0
    Me.FlashG = 1
    End Sub
    Private Sub Option143_GotFocus()
    Me.NoFlash = 1
    Me.FlashL = 0
    Me.FlashG = 0
    End Sub
    Private Sub Option145_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 1
    Me.FlashG = 0
    End Sub
    Private Sub Option147_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 0
    Me.FlashG = 1
    End Sub
    Private Sub Option157_GotFocus()
    Me.NoFlash = 1
    Me.FlashL = 0
    Me.FlashG = 0
    End Sub
    Private Sub Option159_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 1
    Me.FlashG = 0
    End Sub
    Private Sub Option161_GotFocus()
    Me.NoFlash = 0
    Me.FlashL = 0
    Me.FlashG = 1
    End Sub



    Thank you again for all of your help!

  10. #25
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    the screen where there is the red, yellow, and green table.
    I don't remember any colors on the 2nd form - just the option buttons. So for the weld quality, it would be
    0 - GREEN = No flash
    1 - YELLOW = Flash <3ft
    2 - RED = Flash > 3ft

    ??



    having 3 seperate fields (No Flash, Flash < 3ft, Flash > 3ft)
    Not really a good way to go.... IMO


    How many times a day or shift do you have to record these welds? Do yo need the time as well as the date?

  11. #26
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I couldn't get my head around the tables idea.

    So take a look at the "URS" section. I changed the button to a label plus some code - there are 3 (custom) buttons (in green).

    I created a couple of forms, queries and forms. I tried to make it so you could adjust the number of records added by changing the number of stations, robots and welds.

    I wanted to add a couple more code changes, but didn't want to delay this too much longer.

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

Similar Threads

  1. Populate Radio Buttons from Database record
    By CementCarver in forum Access
    Replies: 5
    Last Post: 02-25-2013, 12:38 PM
  2. Replies: 11
    Last Post: 02-04-2013, 05:32 PM
  3. Command Buttons
    By BLD21 in forum Access
    Replies: 2
    Last Post: 05-10-2011, 06:27 AM
  4. Make command buttons unique to a record
    By timmy in forum Forms
    Replies: 26
    Last Post: 03-09-2011, 09:51 AM
  5. Command buttons
    By maintt in forum Forms
    Replies: 3
    Last Post: 08-03-2010, 09:52 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