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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use a "POP-UP" form as a MsgBox?]

Status
Not open for further replies.

Jrs2nd

Technical User
Feb 15, 2001
33
US
What I am trying to acheive is the following:
I want to run a query that checks for possible duplicates
in the background(hidden from user) before saving a new
record. If it finds nothing then it continues on and saves
the record. however if it finds matching records (I have a
query that works and a pop-up form that runs the query, and
displays the records in a listbox upon opening) a pop-up
form or Msgbox(can msgbox's include a listbox????)the
pop-up form or Msgbox displays the possible duplicates.

(something like this fake code)
***********************************************
DoCmd.OpenQuery "90day", acViewNormal, acReadOnly(Hidden??)
If False then
Goto Continue_Save_Click:
ElseIf True Then
DoCmd.OpenForm "frm90DayDuplicates", acNormal, , , acFormReadOnly, acDialog
End If

Continue_Save_Click:
etc........
***********************************************

Then( after the user reviews the records) when the user
clicks the "Ok" button on the Pop-up form/MsgBox it returns
to the Save operation at: "Continue_Save_Click:" to
complete saving the record. Or if not, presses the "cancel save" button which will close the Pop-up/Msgbox and stop
the saving operation.

Is this possible or am I spitting into the wind??


Thanks in advance,
Jim
 
That sounds fine, presumably the code would live in before_update? Peter Meachem
peter@accuflight.com
 
Thank you for replying Peter,

I thought that the form's Before_Update()would be the best
place for the procedure but I wasn't sure... not an
advanced programmer.. so I'm "blowing things up" thru trial
and error until it works. try something in before insert(),
"boom" nope.. try on click().."boom" nope..... although I
am trying the code first to see if it works... (took awhile
to figure that out! :eek:) )

Seriously, any ideas on what would make the query run
Hidden. or how to call the Continue_Save_Click event
procedure..
I will post my best attempt tomorrow 6/20/01 thanks in advance for any suggestions..

Jim
 
Okay, here's what I came up with

Private Sub Save_Record_Before_Update()
On Err GoTo Err_Save_Record_Before_Update:

DoCmd.OpenQuery "DynamicAllRecordDuplicates", acViewNormal, acReadOnly
If False Then
GoTo Continue_Save_Click:
ElseIf True Then
DoCmd.OpenForm "frm90DayDuplicates", acNormal, , , acFormReadOnly, acDialog
DoCmd.Close acQuery, "DynamicAllRecordDuplicates", acSaveNo
End If

Exit_Save_Record_Before_Update:
DoCmd.Close acQuery, "DynamicAllRecordDuplicates", acSaveNo
Exit Sub

Err_Save_Record_Before_Update:
MsgBox Err.Description
Resume Exit_Save_Record_Before_Update:

End Sub

I can not get the query to run hidden and I know using
false and true do not give me the result of

if no records(false) then
elseif records(true) then ...

but the pop-up form works and displays the possible dupes
and am working on calling a function from the ok button
to finish saving the record...

I had to close the Query using DoCmd otherwise the
datasheet was left open can't find a way to hide this
I can "cover" it with the pop-up form so it is not seen
but was hoping for a better solution.

any ideas??
Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top