Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup for a pop-up form header? 1

Status
Not open for further replies.

misscrf

Technical User
Jun 7, 2004
1,344
US
For background on this project, you can view this on-going thread here:
thread702-1610544

For this specific question I have - On my main form for events, you add events. There is a subform for inviting people to an event. This subform is continious. Each continuous record has a command button to open a pop-up form where 1 or more people can be set as sending the invite to that person (invite sent on behalf of).

What I would like to do is show as a locked textbox in the pop-up form header. It would have a dlookup of the last name and first name of contact that the user click on the command button for.

When a user clicks the command button, they are brought to the pop-up form, but the subform on the main screen is showing a list of invited people. It will be easy to forget which person you just clicked on, so I want to use a dlookup on a locked field in the pop-up form header, to show that person's name. It will re-inforce or remind them which invite they are choosing account managers that are inviting them.

Events -
PKEvent
txtEventTitle

Event Invite -
PKEventInviteID
FKEvent (looks up to tblevent)
FKContact (looks up to contact table with txtLname and txtFname etc)
etc

Event Invite OBO (on behalf of)
PKEventInviteOBOID
FKEventInvite (event invite id)
FKAM (account manager id)

So when I click from one event invite in the subform I open a pop-up to show just the records for that event invite that exist in the obo table.

I can then add more.

I tried this for a dlookup, but it just gives me #Name

Code:
=DLookUp([txtLName],"tblcontact","tblcontact.PKContactdID = " & Forms!frmEvent!frmSubEventInvite.FKContact & " AND Forms!frmEventInviteOBO.FKEventInvite =  Forms!frmEvent!frmSubEventInvite.PKEventInviteID ")

I know I am explaining this badly, but hopefully someone can read through my madness. I get so far into the problem that it is impossible to explain it. Not to mention I am not good at summarizing a problem.

Thanks for any help, if you get what I am trying to do.

misscrf

It is never too late to become what you could have been ~ George Eliot
 
Howdy misscrf . . .
misscrf said:
[blue] ... but the subform on the main screen is showing a list of invited people. [purple]It will be easy to forget which person you just clicked on[/purple] ...[/blue]
Not true! ... if you have [blue]record selectors[/blue] on. The selector will point to to the record where the button was clicked! Despite this, [blue]I believe its a good idea to show in the pop-up what name was selected[/blue]. Only ... you simply have too pass this name thru the [blue]OpenArgs[/blue] arguement of [blue]DoCmd.OpenForm[/blue]. It your button code would look like:
Code:
[blue]   Dim SelName As String
   
   SelName = Me!LastName & " " & Me!FirstName
   DoCmd.OPenForm "[blue]PopupFormName[blue]", , , , , , SelName[/blue]
In the load event of the pop-up you'd have:
Code:
[blue]   If Me.OpenArgs <> "" Then Me!TextboxName = Me.OpenArgs[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Let me try setting that up. Would I then put the text box control on the pop-up form and have the on open of the form say me.textbox = openargs ?

Funny thing, I never use record selectors. I alway thought they were just there for me to have to turn off when I make a new form lol. I will turn those on too.

misscrf

It is never too late to become what you could have been ~ George Eliot
 
Worked like a charm!!!! Passed the SelName and onload of the pop-up form put me.txtLabel = me.openargs


Star for you, Aceman!


misscrf

It is never too late to become what you could have been ~ George Eliot
 
misscrf . . .

I shold'nt have mentioned [blue]record selectors[/blue] as some sort of dependent ... as its not mandentory they be usd. Its a matter of aesthetics as to wether you use them or not. The point here is that focus moves to the record for the button you clicked. This is what makes it possible to pass the correct cocatenated name!

[blue]your thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I get your point. The thing is I have NEVER used them. I always thought they made the form look very "access" if that makes sense. I did turn them on in this instance, and I have to say it opened my eyes to certain instances, when it can be helpful.

I tend to use a lot of subforms with pop-up forms because the apps I dev for people tend to be a web of 1 - manys. It just allows me to give the users a way to enter info.

This can actually help for those times that whether passing openargs or not, we can see in the form underneath which record they clicked. I do make pop-up forms pop-ups so they can't go click on the main form without closing the pop-up first.

It is, I think, a good idea to pass the open args rather than rely on the record selectos, if only to put the name of the record on the form the users are on, rather than expecting them to look at the background form.

Either way, I take both solutions and thank you for your help!

misscrf

It is never too late to become what you could have been ~ George Eliot
 
misscrf . . .

The pointers do play an important [blue]visual[/blue] role. For instance:
[ol][li]A [blue]black arrow[/blue] reveals the currently selected record.[/li]
[li]A [blue]pencil icon[/blue] reveals the selected record is in [blue]edit mode[/blue] (being edited by the user).[/li]
[li]In a [blue]multiuser envrionment[/blue] an icon is shown if another user is editing the the selected record.[/li][/ol]
Again ... its up to you if you use the selectors or not. Bottom line is always which record has the focus.

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Definitely. I think those benefits are the exact things I was not paying attention to every time I turned that property off.

I appreciate you opening my eyes!!!

misscrf

It is never too late to become what you could have been ~ George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top