Set value question part 2

NWGal
2StarLounger
Posts: 198
Joined: 21 Aug 2011, 02:32

Set value question part 2

Post by NWGal »

I had great help in a previous thread - http://www.eileenslounge.com/viewtopic.php?f=29&t=15353,
What I have is working, but I'd like to try a different layout.
In a nutshell, when I open frmContactInfo, and go to the Assignment Tab, if the contact is a 1, I see the assignment subform for that person. I have put an add team button in the header which opens frmNewTeam, the underlying tblTeam gets the basic team info and the tblAssign gets updated with a record or records for team members chosen from a combo box on sbfrmVol. What I can't figure out is how to add and update tblAssign for the individual contact, without using a combo box which is an extra step of looking for the contact in a list, when I already have his/her info form open. Hope that makes sense.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Set value question part 2

Post by HansV »

In the code behind frmNewTeam, you can refer to Forms!frmContactInfo!ContactID where ContactID is the field on frmContactInfo that uniquely identifies the contact.
I hope that gives you a starting point. If not, I'd need to know more about frmContactInfo and frmNewTeam.
Best wishes,
Hans

NWGal
2StarLounger
Posts: 198
Joined: 21 Aug 2011, 02:32

Re: Set value question part 2

Post by NWGal »

HansV wrote:In the code behind frmNewTeam, you can refer to Forms!frmContactInfo!ContactID where ContactID is the field on frmContactInfo that uniquely identifies the contact.
I hope that gives you a starting point. If not, I'd need to know more about frmContactInfo and frmNewTeam.
Well, the challenge is that frmNewTeam is based on the tblTeam, which doesn't hold individual contact data, just team data. This is why I'm using a subform on frmNewTeam, which is connected to tblAssign which is a junction table, brining together the "who" parts, with the "what" whole. Assignment table holds teamId, conid and roleid. So I can't have a text field ConID on frmNewTeam, I need to have it in the subform, like I currently have the combobox, but I get lost at that point.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Set value question part 2

Post by HansV »

I'd have to see the current version of the database...
Best wishes,
Hans

NWGal
2StarLounger
Posts: 198
Joined: 21 Aug 2011, 02:32

Re: Set value question part 2

Post by NWGal »

HansV wrote:I'd have to see the current version of the database...
Here you go. Thanks
ABLEdbZip2.zip
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Set value question part 2

Post by HansV »

I'm afraid I don't understand the setup. The subform sbfrmAsgnInd shows Programs, not Teams, but you want to use the button to add a Team... :scratch:
Best wishes,
Hans

NWGal
2StarLounger
Posts: 198
Joined: 21 Aug 2011, 02:32

Re: Set value question part 2

Post by NWGal »

HansV wrote:I'm afraid I don't understand the setup. The subform sbfrmAsgnInd shows Programs, not Teams, but you want to use the button to add a Team... :scratch:
Whoop's - I quickly saw that I had failed to copy over the changed query. Now the teamid field is available for sbfrmAsgnInd. I haven't put just haven't put a textbox there yet.
The corrected zip is here:
ABLEdbZip2.zip
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Set value question part 2

Post by HansV »

I still don't understand how you can use a form that adds a team from a subform that does not display teams but programs. Sorry.
Best wishes,
Hans

NWGal
2StarLounger
Posts: 198
Joined: 21 Aug 2011, 02:32

Re: Set value question part 2

Post by NWGal »

HansV wrote:I still don't understand how you can use a form that adds a team from a subform that does not display teams but programs. Sorry.
Hmmm, I thought of using that subform just as a convenient place for the button to open the Team Form and add a team. The Contacts info is already on that mainform/subform, as far as ID and it seemed like this would save steps.

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Set value question part 2

Post by HansV »

I'd open frmNewTeam from the main form, not from the subform. The contact information is available in the main form.
Best wishes,
Hans

NWGal
2StarLounger
Posts: 198
Joined: 21 Aug 2011, 02:32

Re: Set value question part 2

Post by NWGal »

HansV wrote:I'd open frmNewTeam from the main form, not from the subform. The contact information is available in the main form.
Well, I solved my problem and this time your help was more indirect, but appreciated none-the-less. Your confusion got me thinking, and I was able to step back and see this from a different angle. I was overthinking it. What I ended up doing last night was: I put the button on the Mainform, removed the combobox from sbfrmInd, and instead simply put the two fields, RoleID and ConID on this. THEN on frmNewTeam, I put code in the after update event that gets the ConID from my mainform, and set's the RoleID to 1, since that is the only role I need to work with. Now I have it working beautifully!!!
Thank you!

User avatar
HansV
Administrator
Posts: 78589
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Set value question part 2

Post by HansV »

Good to hear that!
Best wishes,
Hans