powersso
Feb 1 2007, 01:02 PM
I have a form that requires the user to enter all data prior to being able to close the form A Command button at the end of the form "Return to Main Menu" verifies all fields have been completed and will not let the user exit if the fields are not completed. If the fields are completed the command button
returns to main menu.
I want to try and add another twist to this.
I would like to have the user verify that the number they have written down is the number they just recorded. I have another form that the users can look up their number on at a later date, but I want to force them to open
that form immediately upon exiting the entry form.
Here is what I was thinking:
Msgbox "Verify your Case Number is Correct", vbCritical, "VERIFICATION NEEDED"
DoCmd.OpenReport "rpt_DSCR", acviewpreview
I discovered as long as the form is open then the number doesn't appear; however, if I close the form and run the option to look up the number is there.
Basically I need is to have the user re-enter their number and verify the
data is true.
Any advise.
Thanks Sondra
ScottGem
Feb 1 2007, 01:08 PM
You probably need to commit the record via a
DoCmd.RunCommand acCmdSaveRecord
before you open the other form.
dashiellx2000
Feb 1 2007, 01:08 PM
I think I'd go about this a little differently.
What I would do is add:
If Me.Dirty = True Then
Me.Dirty = False
End if
This will "save" the record and your case number would then appear in table for other coding to pick up. I'd then have a form open in dialog mode for the user to reenter the number and then using a recordset, make sure that the two match.
HTH.
freakazeud
Feb 1 2007, 01:08 PM
Hi,
I'm not sure what you mean. You are talking about a form...but then your code opens a report.
Is the form which they have to fiill out modal? If so then the report won't be visible until you close or hide this form.
You could temporarily hide it and then show it again on the reports on close event. But I think you want a form.
So just create a new small pop up and modal form and open that instead. Then compare the values entered in a control on that form and the old one and you should be good to go.
HTH
Good luck
powersso
Feb 1 2007, 01:56 PM
Thank you for your answer it seems to be the easiest to understand. I'm very novice when it comes to understanding programming, but it worked perfect with one exception. Here is the coding....
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Verify your Case Number is Correct", vbCritical, "VERIFICATION NEEDED"
DoCmd.OpenReport "rpt_DSCR", acViewPreview
The rpt_DSCR is activated by a query which asks the user to enter the DSCR#. The user enters the DSCR# they just entered and verifies the information is corrrect.
Here is the problem:
The user then closes the report using the close window button. But if the user needs to enter another DSCR and presses the Initate new DSCR button on the switchboard it opens the same one the user just did.
So somehow I need to close the active form after verification of the number has been done so that when the user tries to enter another DSCR they only see the empty data entry form.
Hope it makes sense.
Sondra
ScottGem
Feb 1 2007, 03:07 PM
Instead of prompting for the DSCR, set the criteria in the query to:
=Forms!formname!Controlname
Then it will pick up whatever is currently displayed.
powersso
Feb 1 2007, 08:32 PM
Sorry not sure I understand.
Please expand.
Sondra
ScottGem
Feb 1 2007, 08:44 PM
If you set the criteria in your query uising that syntax, it will pick up whatever value is on the form. So you don't have to prompt for the value.
powersso
Feb 2 2007, 01:04 PM
ScottGem
So instead of the parameters of [Enter DSCR Number] I would enter the criteria identified; but where to I put that in my query?
I'm sorry I'm very confused.
S
ScottGem
Feb 2 2007, 03:21 PM
Again, you enter the criteria as:
=Forms!formname!controlname
powersso
Feb 5 2007, 11:30 PM
Again, do I enter this into the query or the form?
ScottGem
Feb 6 2007, 08:51 AM
Criteria is entered in a query.
powersso
Feb 7 2007, 08:19 PM
I'm sorry that I'm so DUMB when it comes to this, but I am not sure this is going to work.
Basically what I need is just for the form to close COMPLETELY and return to main switchboard.
So when the user chooses the close window button on the form it completely saves all data and returns the main switchboard.
When the user presses the button to begin a new entry...the form is empty.
Thanks.
Sondra
ScottGem
Feb 7 2007, 08:49 PM
We seem to be talking about two different things. If you have a bound form, then when you close the form the data is saved. If you use a switchboard it should be there when the form closes. If you select to Open a form in
Add mode, it wil do that.
powersso
Feb 8 2007, 03:50 PM
Here is what I have:
1. I start with a switchboard that opens a form in add mode
2. The user's enter all the required data and when they have finished they press a button to return them to the switchboard. The coding for the command button is:
Private Sub MenuBut_Click()
If IsNull(Me.Department) Or IsNull(Me.State) Or IsNull(Me.Initials) Or IsNull(Me.Date) Or IsNull(Me.WBN) Or IsNull(Identifier) Or IsNull(DonorLastName) Or IsNull(DonorDOB) Then
MsgBox "You left a required field blank. Please go back and enter the required information", vbCritical, "Field Required"
Else
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Verify your Case Number is Correct", vbCritical, "VERIFICATION NEEDED"
DoCmd.OpenReport "rpt_DSCR", acViewPreview
End If
End Sub
When the user clicks this button the report opens and verifies that the Number they just entered was there. If the report comes up blank it verifies that the number didn't get accepted into the system.
Now this is where my problems begins. The user clicks the close button on the report window and it returns the user to the Switchboard. (The report close event procedure is set to open the frm_DSCRSB).
But if the user presses the button to initiate a new DSCR (opens the INITIATE DSCR FORM) the correct form is open; however, it opens to the same record that was just being verified.
I'm not sure how to fix this or where I need to write more directions. I want the INITIATE DSCR FORM to close and save when the user closes the report.
Does this make any sense.
Sondra
ScottGem
Feb 8 2007, 07:02 PM
Ok, let first go with the open report. Does it work now opening the report to the currently displayed record? If not, then you need to change the OpenReport line to add a Where clause to specify the DSCR as I told you earlier.
Second, did you use Access' Switchboard Manager to create the Switchboard? Did you use the choice to open in Add mode?
Also, what is the code for the Report Close?
powersso
Feb 12 2007, 10:04 PM
The Report opens with the query and the parameters of the query are "Enter the DSCR#" - The user enters the number and a DSCR# and the report shows all the fields for that DSR.
I created my own switchboard. Yes the form opens in the ADD mode when it is originally opened.
The code for the Report Close is:
Close
do.cmd OpenForm "frm_InitiateDSCR"
Hope that helps.
ScottGem
Feb 13 2007, 08:29 AM
If the DSCR# is already displayed on the form you are calling the report from then there is no reason to enter it again. You can reference the value from the form as I explained earlier.
If your switchboard has a button that opens a form in Add mode, then that button should always open the form in Add mode.
powersso
Feb 15 2007, 12:53 PM
Scott:
I'm sorry this is so complicated because I believe it should be so easy but I don't know how to put it in words to make it easy. So I'm starting here:
1. Users use the switchboard "frm_SB" where they choose a command button to initiate a new form.
2. The command button opens the form "frm_initiateDSCR" which enters in Add Mode
3. The User enters data into the first field which gives them the next numerical number.
**Because multiple users can get into the database the number will be the same for any and all users which are currently in the database until the record is saved.****
4. Because of the chance of multiple users having the same number, I created a "verification" option where the user clicks the "RETURN TO MAIN MENU" command button which forces the user to enter the number he/she just created and wrote on their form and opens a report to show them the data associated with that DSCR#.
5. Currently the report that opens is linked to a query that asks the user to enter the DSCR# they wish to review. (This is where you are saying I shouldn't have them enter the number)...but I DO NOT know how to do it any other way.
6. After the user has review the report they choose the close window button and it returns them to the "frm_SB" to either re-enter the DSCR# or enter another DSCR.
7. The user choosed the command button to open the form "frm_iniitiateDSCR" which in #2 opened in ADD Mode; however, now opens in the form that was originally entered.
Again, I'm sorry I'm not understanding everything. But basically I need to make that form close completely upon leaving the screen. If the user enters their number and it doesn't come up then they know they will need to re-enter.
Thanks again for your patience and help.
S
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.