Pop Up Parameter Prompt Form

G

Guest

Hi,

I need to create a form that will pop up when label is clicked to prompt
user for new job number of form that is open and then close to view info on
first form. I have read threads for modal dialog boxes and for pop up boxes
and am not sure how to go about it. I have forms that prompt for input
before reports are printed or viewed, but I need this one to close once the
job number is entered.

Form is "fGeneralInfo" with label "LblJobNumber" and also field "JobNumber".
I hope this explains what I'm trying to do.
Any help is greatly appreciated!
Thanks,
Pam
 
G

Guest

Open the form you want to use to get the job number using acDialog in the
Window Mode argument of the OpenForm method. This is necessary to halt the
code in the opening procedure until the popup form is closed.

Once the job number is entered and, if necessary, verified in the popup,
pass the value entered back to the opening form and close the popup form.
You did not say which form you gave the name and info for, so I can't use
actual names, but assuming the info you provided is on the main form, you
would use something like this in the popup:

Forms!frmMainForm!txtJobNumber = Me.txtJobNumber
Docmd.Close acForm, Me.Name, acSaveNo
 
G

Guest

Klatuu,

Thanks for the quick reply. I know this should be easier than it is, but I
still can't get it to work. If you would be so kind as to check my code to
see if correct and in the right locations, I would really appreciate it.

Main Form "fGeneralInfo"
TextBox "JobNumber"
Label for popup "LblJobSearch" has code:
Private Sub LblJobSearch_Click()
DoCmd.OpenForm "fJobNumber", , , , , acDialog
End Sub

This part works - I can get the pop up to open.

PopUp Form "fJobNumber" has code:
Private Sub Form_AfterUpdate()
Forms!fGeneralInfo!JobNumber = Me.TxtJobNumber
DoCmd.Close acForm, Me.fJobNumber, acSaveNo
End Sub
Unbound Textbox "txtJobNumber"

When I enter job number into the unbound textbox on the popup - it just sits
there. It doesn't change the job number on the main form and the popup
doesn't close.

Pam
 
G

Guest

Almost the right code in the popup, but two issues.
First, The After Update event of the form will not fire until you make a
change to the form's recordset and try to move to another record. You should
use the control's After Update or add a command button to the form and use
it's Click event.

Second, With the Close method, it is looking for a string that is the name
of the object to close. Instead of Me.fJobNumber which returns the job
number, use it as I wrote it Me.Name which returns the name of the form.

Private Sub txtJobNumber_AfterUpdate()
Forms!fGeneralInfo!JobNumber = Me.TxtJobNumber
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
 
G

Guest

I tried the code you gave in the AfterUpdate of the text box on the pop up
form and received message: Runtime error 2448 You can't assign value to this
object. When I pressed Debug, the first line of code was highlighted -
forms!fgeneralinfo!.... So, I thought it might go in the AfterUpdate for the
form - no error msg, but still didn't work. I changed Me.Name thinking since
you didn't have the pop up form name, it was a generic entry for me to change
when code was applied.
Anyway, I did as you said, left code alone and put in form's Afterupdate and
still get same error msg as above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Prompt for Parameter Value Help 6
Parameter Value Help 1
Pop Up Form Question 3
Pop Up Form Focus Question 1
Pop Up Form Focus Question 1
Pop Up Form Focus Question 2
Pop Up Form Focus Question 1
Parameter Value?? 10

Top