Results 1 to 10 of 10
  1. #1
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22

    option group radio buttons


    Hi!
    I have a form, say form 1. I have picked up two values, invoice number and invoice date from this form and passed it onto another form,say Form2, on a button's on_click event.This is working alright except that, the rest of the fields in form2 get populated automatically with the first record in the table associated with form2.
    What am i doing wrong?
    Also, I have an option group on form2 with two radio buttons(yes and no). I have set the default value as NO. But somehow when i open the form in 'Form View', no option is selected....
    Please help!
    Thank you.

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Option groups stores value with an Index Number. Say if you have two values Yes and No. Yes will be 1 and No will be 2. So in the default value enter numbers in your case it will be 2.

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Answer to your first question. Check out a very similar post that I answered today. I think it will help you if it doesn't let me know.

    Check out this link

    https://www.accessforums.net/program...w-vb-4735.html

  4. #4
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22
    I guess you misunderstood my radio button problem. When i click 'Save', the option value button stores the value in the table, But it does not show any selected value. That blue dot that occurs on selection of radio button (if you know what i mean )does not appear!!Even if i click on 'Yes',it does not appear.
    And the form problem. I know whats happening. But i dont know what to do about it.
    I have ID(autonumber), invoice number, invoice date, itemname and unit price on my form 2. Now i am passing invoicenumber and invoice date from form 1 to form2 on button click,which is working perfectly. BUT since a new form opens to the first record of form2, it is picking the Id, itemname and unitprice of the first record!!so i cant enter a new record!!
    i hope i hvnt made the question too complicated...

  5. #5
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22
    bah!!dont bother about the radio button. I got it!! The data type for the field should have been 'number' and I chose 'Yes/No'..sorry... :|
    Please help me with the form problem.
    Thanks.

  6. #6
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    see told you number is the key.

  7. #7
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    What do you mean by passing on. Are you copying the values from the first form to the other. it will be much easy for me to help you if you will tell me what you want to do rather than explaining what is the problem.

  8. #8
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22
    okay.I'l tell you what I want.
    My form1 has invoice number and invoicedate and some other fields. When I click a button on form1,Form2 opens to a new record with the invoicedate and Invoice number from form1....(Form2 has a different table and different fields)
    IS it possible to do something like this?

  9. #9
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Let me get this straight. you want to open a form in acFormAdd mode(Blank Form and copy Invoice Date and Invoice number.

    Example code:

    I have two forms Main and Main3

    I will open a Blank Main3 Form and Copy the value of three Fields Details, de, da on to Main3 Form.


    Private Sub Command17_Click()
    On Error GoTo Err_Command17_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Main3"
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
    Forms!Main3!Details = Me.Details
    Forms!Main3!de = Me.de
    Forms!Main3!da = Me.da

    Exit_Command17_Click:
    Exit Sub

    Err_Command17_Click:
    MsgBox Err.Description
    Resume Exit_Command17_Click

    End Sub


    in this example the Fields in both the form has same names. it will even work if you have different field names.
    if this solves your problem mark this thread solved.

  10. #10
    ManC is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    22
    Awesome!!its working!!
    Thanks a tonne!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Option Group
    By huskies in forum Forms
    Replies: 9
    Last Post: 12-02-2009, 12:06 PM
  2. VB code for sending email through Option Group?
    By getdpt in forum Programming
    Replies: 0
    Last Post: 08-23-2009, 03:59 PM
  3. option group in form
    By mawa4492 in forum Forms
    Replies: 1
    Last Post: 08-05-2009, 02:49 PM
  4. VBA Code in Access w/ option buttons
    By WebKiid in forum Access
    Replies: 1
    Last Post: 07-16-2009, 12:20 PM
  5. Option Group broken out
    By dcecil in forum Reports
    Replies: 3
    Last Post: 04-21-2009, 10: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