Results 1 to 13 of 13
  1. #1
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34

    capturing the address repeatedly


    I have a form containing Mailing address, mom address and dad address all in the same form.
    Form should capture the mailing address for mom and dad when the user clicks, same as above. How do I do that?

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I assume that by "Capture" you mean to say that If the mailing address is as same as Mom and Dads address then you want by some means enter then on to the other two fileds with out Typying.

    Exapmle
    I have a Form called Address
    I have the following TextBox
    Mailing Address
    Mom_Address
    Dad_Address

    I have used a Command Button on its on click event


    If isNull(me.Mailing address) them
    msgbox "Please Type a Mailing Addersss",vbInformation
    else
    Me.Mom_Address = Me.Mailing_Addresss
    Me.Dad_Address = me.Mailing_Adderss
    End if

    I have Included a sample db for you.

  3. #3
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34

    capturing the same address at various places

    Thanks Maximus for your effort. Yes, your onclick event was something similar to what I was looking for.

    I have attached my database. Please look into that.

    Click "Patient Data". On the main form of Patient information, there is a mailing address, city and zip.

    When the user goes down to " Parent info" subform, I will have a check box for both mom and dad. If they click that the same above address should be captured, instead of repeated typing.

    I am not sure of how to do that. Please teach me.

    Moreover, I have another problem in my database. Want your idea of how to solve that issue.

    Go to a new record in my db.
    -enter a 4 digit patient id.
    -go to "pediatrician" or "genetic center" subform and select one from the combo box.
    -It gives error that "creating duplicate values".
    -Now If I undo the above and go out to a different record and comeback to the recently created record, it is allowing to choose from the combobox.

    Please let me know, where I am making a mistake.

    Thank you for all your efforts.
    Last edited by simba; 03-20-2010 at 03:19 AM. Reason: spelling mistake

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I have added a option group where you have three options
    1) copy both this copies Mailing address to both Mom and Dad
    2) Only Mom this copies address only in MoM
    3) Copies only in Dad's

  5. #5
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34
    Thanks Maximus! This is what I was looking for. Appreciate all your help. Can you be kind enough to look into the second problem, I have mentioned above.

    Anyway, I marked this thread as solved.

  6. #6
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    The problem lies in the fact that you are usin a part of the tbl patient as a sub form to itself (sfrmCurrentPediatrician, sfrmFormerPediatrician) well if you will give me details like what you want to do I will be glad to build the database for you.
    my email silverback_bats@yahoo.co.in.

  7. #7
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34
    do u mean using of the fields currentPed and formerPed in the tblPatients?

    All I want is that, when the user starts entering the new record and while selecting the combo box, it shouldn't give out an error.

    Please let me know, how I should redesign my tables/ forms to avoid that conflict.

    Thanks in advance

  8. #8
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    sure I will help. I had a quick glance at you table and form structure. The problem is the way you are handling the data entry it will cause problems. I prefer my users entering through unbound forms and then appending the data after verification using SQL VBA. I think I have to make some minor changes. Hope you can wait till Monday.

  9. #9
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34
    thank you and have a nice weekend.

  10. #10
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34
    Maximus! I have a doubt here.

    with option button, I couldn't deselect. For example, there may be a chance that mom or dad address can be same as mailing or change to a different address. Hence, my best option to go for "Check box".

    I thought of putting Check boxes for mom and dad separately, with the label " Same address as above".

    Can you verify the code below please, as I cannot make it work.

    Private Sub chkMomAddr_Click()
    Select Case Me.chkMomAddr
    Me.MAddress = Me.Address
    Me.MCity = Me.City
    Me.MState = Me.State
    Me.MZip = Me.Zip
    End Select
    End Sub

  11. #11
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34
    got it worked as follows:

    Select Case Me.frmOption
    Case Is = 1
    Me.MAddress = Me.Address
    Me.MCity = Me.City
    Me.MState = Me.State
    Me.MZip = Me.Zip
    End Select

    Is the above code should be under click or on focus?

    how to reset the data, when un-check is done?

  12. #12
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Sorry For the delay to answer. What I have done is that I have created three seperate sheck Boxes for u. Both, Mother, Father. Checking them will copy the Mailing address and unchecking then will clear data. Check it out. Is that error problem is solved taht you had mentioned previously.

  13. #13
    simba is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Mar 2010
    Posts
    34
    Thanks maximus. I looked at your check boxes code. But wondering, whether it is Ok or not. Once you check the box for mom or dad or both and you move to a different record and still the check box will be in the same place. However, I checked the table and it is capturing the data correctly.

    I also got it using the following code.

    Private Sub chkDadAddr_Click()
    If chkDadAddr.Value = -1 Then

    Me.FAddress = Me.Address
    Me.FCity = Me.City
    Me.FState = Me.State
    Me.FZip = Me.Zip
    Else
    Me.FAddress = ""
    Me.FCity = ""
    Me.FState = ""
    Me.FZip = ""
    End If
    End Sub
    Private Sub chkMomAddr_Click()
    If chkMomAddr.Value = -1 Then
    'chkMomAddr.Caption = "Checked" ---comment field

    Me.MAddress = Me.Address
    Me.MCity = Me.City
    Me.MState = Me.State
    Me.MZip = Me.Zip
    Else
    ' Check1.Caption = "Unchecked" --- comment field
    Me.MAddress = ""
    Me.MCity = ""
    Me.MState = ""
    Me.MZip = ""
    End If
    End Sub


    My other problem is not yet solved which has been mentioned in my previous post.

    Go to a new record in my db.
    -enter a 4 digit patient id.
    -go to "pediatrician" or "genetic center" subform and select one from the combo box.
    -It gives error that "creating duplicate values".
    -Now If I undo the above and go out to a different record and comeback to the recently created record, it is allowing to choose from the combobox.

    Please let me know, where I am making a mistake

    You suggested some design changes. waiting for that.

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

Similar Threads

  1. how to validate the first line of address
    By dunners92 in forum Access
    Replies: 1
    Last Post: 03-15-2010, 09:53 PM
  2. Replies: 1
    Last Post: 10-07-2009, 08:15 AM
  3. Input Mask for an IP Address and Mack Address
    By baksg1995 in forum Access
    Replies: 18
    Last Post: 06-23-2009, 12:33 PM
  4. Replies: 1
    Last Post: 05-01-2009, 07:33 AM
  5. Replies: 1
    Last Post: 09-20-2007, 02:56 PM

Tags for this Thread

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