Pop up form (1 Viewer)

Dick7Access

Dick S
Local time
Today, 14:27
Joined
Jun 9, 2009
Messages
4,201
I am trying to learn normalization. Previous I had all information about a record in the same table.
On my trial I have phone numbers in a separate table. I have a pop up form that I open from a command button.
If I put the phone form on top of the main form and set the master field and child field it will sync the three sample phone numbers to the correct record.
However, once I remove the phone form from the main form and open the phone form with a command button they are no longer sync. What am I doing wrong?
 

Mark_

Longboard on the internet
Local time
Today, 11:27
Joined
Sep 12, 2017
Messages
2,111
You would normally do this in a parent/child related Form/Subform. Rather than "Pop up" information which users would normally see you put the information on a subform that they can scroll through.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:27
Joined
May 7, 2009
Messages
19,231
In the load event of the pop up find the id of the main form


Private sub form_load()
With me.recordset
.findfirst "id=" & forns!formA.id
End with
End sub
 

Dick7Access

Dick S
Local time
Today, 14:27
Joined
Jun 9, 2009
Messages
4,201
In the load event of the pop up find the id of the main form


Private sub form_load()
With me.recordset
.findfirst "id=" & forns!formA.id
End with
End sub

Not working. Did I get something wrong?
Code:
Private sub form_load()
.FindFirst "id=" & Forms!frmChurchesNew.id
End sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:27
Joined
May 7, 2009
Messages
19,231
Ok just change the recordsource of the pop up.

Private sub form_load()
Me.recordsource="select * from yourTable where fk=" & forms!frmChurchesNew!id

End sub


fk is the field on your pop up (foreign key) that has same value as your main form
 

missinglinq

AWF VIP
Local time
Today, 14:27
Joined
Jun 20, 2003
Messages
6,423


Not working. Did I get something wrong?


Code:
[B]Private sub form_load()
.FindFirst "id=" & Forms!frmChurchesNew.id
End sub[/B]
arnelgp's example assumed that id was Numeric (most experienced developers use a Numeric id number.) If it is defined as Text, however, the correct syntax would be

Code:
[B]Private sub form_load()
.FindFirst "id='" & Forms!frmChurchesNew.id & "'"
End sub[/B]
Note that I also agree with Mark that you would normally do this in a parent/child configuration...using a Form/Subform to display and for data entry...rather than having a Popup Form for the phone numbers.

Also, avoid the mistake that many newbie's make, in trying to accomplish Normalization...don't overdo it! I've seen newbies who had a separate Table for Date of Births, Primary Residences, etc...things of which there can only be one valid value.

If there is the possibility of having multiple phone numbers, for a given Record, then yes...have phone numbers in a second Table. But of you're only interested in a single contact phone number, keep it in the primary Record.

Linq ;0)>
 
Last edited:

Dick7Access

Dick S
Local time
Today, 14:27
Joined
Jun 9, 2009
Messages
4,201
arnelgp's example assumed that id was Numeric (most experienced developers use a Numeric id number.) If it is defined as Text, however, the correct syntax would be

Code:
[B]Private sub form_load()
.FindFirst "id='" & Forms!frmChurchesNew.id & "'"
End sub[/B]
Note that I also agree with Mark that you would normally do this in a parent/child configuration...using a Form/Subform to display and for data entry...rather than having a Popup Form for the phone numbers.

Also, avoid the mistake that many newbie's make, in trying to accomplish Normalization...don't overdo it! I've seen newbies who had a separate Table for Date of Births, Primary Residences, etc...things of which there can only be one valid value.

If there is the possibility of having multiple phone numbers, for a given Record, then yes...have phone numbers in a second Table. But of you're only interested in a single contact phone number, keep it in the primary Record.

Linq ;0)>
Thanks for the info. I will try to incorporate what you said hopefully in a few days. I have just driven from FL to TX and am beat, plus I have a meeting tomorrow morning. Yes some of my records have as many as 8 phone numbers.
Ps. I can get a form and sub from synced but only if sub form is on top of the sub form. I am looking to hide all that stuff like phone number, emails etc. until
I need it. Am I looking in the wrong direction with either pop up or sub forms.
 

Mark_

Longboard on the internet
Local time
Today, 11:27
Joined
Sep 12, 2017
Messages
2,111
Thanks for the info. I will try to incorporate what you said hopefully in a few days. I have just driven from FL to TX and am beat, plus I have a meeting tomorrow morning. Yes some of my records have as many as 8 phone numbers.
Ps. I can get a form and sub from synced but only if sub form is on top of the sub form. I am looking to hide all that stuff like phone number, emails etc. until
I need it. Am I looking in the wrong direction with either pop up or sub forms.

Not sure what you mean by that.

Normally your "Phone" table will have a copy of the parent record's ID and you would link "Parent_ID" to "Copy of Parent_ID" in your relationships.

For myself, I don't limit contacts to just "Phone". I have
ContactID
Parent_ID
ContactType (Normally a lookup, normal values being "Phone","Email",Messenger"
ContactValue (Phone number or Email address for most)

This allows you to use one table to store any way you contact a given person and is open more types (Fax, mobile, Radio call sign, what have you) if you find a need. I normally leave contact value as free form text unless there is a need to apply a format. This would allow you to have an entry form for "Phone number" that puts the correct format and type in for users.
 

Users who are viewing this thread

Top Bottom