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?
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?
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.
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
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
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.
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.
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
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.
thank you and have a nice weekend.
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
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?
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.
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.