A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Requerying a pop up form to display in the main form



 
 
Thread Tools Display Modes
  #11  
Old April 5th, 2005, 05:11 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

What is the code that runs when you click the "quick call button"? What is
the code that runs in the popup form's Close event and in the "done entering
data" button on the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
The form that is open is my Daily dispatch Log. It is used to track all
calls. However if i am in the middle of a call I want to press the quick
call button and fill in 5 fields and then close the form. The pop up form
opens to the next availble record in the Daily Dispatch Log. The problem
is
when I close the pop up form the Daily Dispatch log goes to record 1 and
does
not show that I have added a record. I need it to requery the Daily
Dispatch
Log so I can see the call I added with the Quick Call form. Now if I
close
the Daily Dispatch Log and reopen it, it shows the record I added.

Jen

"Ken Snell [MVP]" wrote:

Let me try asking my question in a different way.

In the form that is open all the time, you do something to cause the
popup
form to be opened. Click a button? Post the code that runs in order to
cause
the popup form to open.

--

Ken Snell
MS ACCESS MVP


"Jennifer P" wrote in message
...
Okay I understand that however I have the main form open all the time
it
never closes. The pop form's information is not journaling to the main
form
unless I close the main form then I can see it when I reopen it.

"Ken Snell [MVP]" wrote:

As I indicated in my first reply, this can be done by adding a requery
step
to the code that is opening the form. Can you post the code that is
run
when
you click the button to open the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
Okay my pop up is working but the main form that the information
goes
to
is
not updating with the information from the pop up unless I close it
and
open
it

"Ken Snell [MVP]" wrote:

How are you opening the popup form now?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
Okay forgive me I am not that advance with Access YET...
I am not sure what "dialog mode" refers to

"Ken Snell [MVP]" wrote:

In the code that opens the popup form, after the line that opens
the
form
(in dialog mode, right?), put a requery step for your current
form.

Something like this:
DoCmd.OpenForm "popup form", , , , , acDialog
Me.Requery

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in
message
...
I have a form call Daily Dispatch Log its table is also Daily
Dispatch
Log.
I have a pop up form "Quick Call" that opens to a new record
if
I
am
in
the
Daily Dispatch Log and allows me to put another record in
with.
(Officer,Call
Type, Location, License, State, On Scene). I created the pop
up
form
so
if I
was in a call I could quickly add another record with out
having
to
leave
the
screen I was in. I need help in setting this pop up form to
requery
the
information on the Daily Dispatch Log so I am not having to
close
it
out
to
see it on the main form "Daily Dispatch Log"

Thanks in advance Jen














  #12  
Old April 5th, 2005, 06:01 PM
Jennifer P
external usenet poster
 
Posts: n/a
Default

These are the codes that I have. When I insert the Me.Requery I get an error
message.

Private Sub CmdQuickCall_Click()
On Error GoTo Err_CmdQuickCall_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "QuickCall", , , , , acDialog
Me.Requery


Exit_CmdQuickCall_Click:
Exit Sub

Err_CmdQuickCall_Click:
MsgBox Err.Description
Resume Exit_CmdQuickCall_Click

End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "QuickCall", , , , , acDialog
DoCmd.GoToRecord , , acNewRec
End Sub

Private Sub OnScene_Click()
Me![On Scene] = Now()
End Sub
Private Sub CmdCloseForm_Click()
On Error GoTo Err_CmdCloseForm_Click


DoCmd.Close


Exit_CmdCloseForm_Click:
Exit Sub

Err_CmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_CmdCloseForm_Click

End Sub
Private Sub CmdRefresh_Click()
On Error GoTo Err_CmdRefresh_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_CmdRefresh_Click:
Exit Sub

Err_CmdRefresh_Click:
MsgBox Err.Description
Resume Exit_CmdRefresh_Click

End Sub


"Ken Snell [MVP]" wrote:

What is the code that runs when you click the "quick call button"? What is
the code that runs in the popup form's Close event and in the "done entering
data" button on the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
The form that is open is my Daily dispatch Log. It is used to track all
calls. However if i am in the middle of a call I want to press the quick
call button and fill in 5 fields and then close the form. The pop up form
opens to the next availble record in the Daily Dispatch Log. The problem
is
when I close the pop up form the Daily Dispatch log goes to record 1 and
does
not show that I have added a record. I need it to requery the Daily
Dispatch
Log so I can see the call I added with the Quick Call form. Now if I
close
the Daily Dispatch Log and reopen it, it shows the record I added.

Jen

"Ken Snell [MVP]" wrote:

Let me try asking my question in a different way.

In the form that is open all the time, you do something to cause the
popup
form to be opened. Click a button? Post the code that runs in order to
cause
the popup form to open.

--

Ken Snell
MS ACCESS MVP


"Jennifer P" wrote in message
...
Okay I understand that however I have the main form open all the time
it
never closes. The pop form's information is not journaling to the main
form
unless I close the main form then I can see it when I reopen it.

"Ken Snell [MVP]" wrote:

As I indicated in my first reply, this can be done by adding a requery
step
to the code that is opening the form. Can you post the code that is
run
when
you click the button to open the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
Okay my pop up is working but the main form that the information
goes
to
is
not updating with the information from the pop up unless I close it
and
open
it

"Ken Snell [MVP]" wrote:

How are you opening the popup form now?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
Okay forgive me I am not that advance with Access YET...
I am not sure what "dialog mode" refers to

"Ken Snell [MVP]" wrote:

In the code that opens the popup form, after the line that opens
the
form
(in dialog mode, right?), put a requery step for your current
form.

Something like this:
DoCmd.OpenForm "popup form", , , , , acDialog
Me.Requery

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in
message
...
I have a form call Daily Dispatch Log its table is also Daily
Dispatch
Log.
I have a pop up form "Quick Call" that opens to a new record
if
I
am
in
the
Daily Dispatch Log and allows me to put another record in
with.
(Officer,Call
Type, Location, License, State, On Scene). I created the pop
up
form
so
if I
was in a call I could quickly add another record with out
having
to
leave
the
screen I was in. I need help in setting this pop up form to
requery
the
information on the Daily Dispatch Log so I am not having to
close
it
out
to
see it on the main form "Daily Dispatch Log"

Thanks in advance Jen















  #13  
Old April 5th, 2005, 06:37 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

It will help us here if you identify which code is in which form...

I am assuming that CmdQuickCall_Click is in the main form (your Daily
Dispatch Log form); and that all the other code is from the popup form (your
QuickCall form)? Is this correct?

What error message do you get from the Me.Requery step?

Are you in the middle of entering/editing a record on the Daily Dispatch Log
form when you click the QuickCall button? It appears that you use the
QuickCall form to enter a new record that is to be displayed on the Daily
Dispatch Log form after it's entered. Is the Daily Dispatch Log form
filtered in any way? Does the QuickCall form have the same filter so that
the entry you make would show on the Daily Dispatch Log form if it had
already been there?

Note that the Me.Requery step will indeed put the form back at the "first"
record. It appears that you want the form to "move" to the newly entered
record (the one entered via the QuickCall form)? If yes, it'll be necessary
for the Daily Dispatch Log form to know what the primary key value is for
the newly entered form. This can be done if you don't close QuickCall form,
but instead make it invisible (after saving its current record), let the
code in the Daily Dispatch Log form read the primary key value from the
QuickCall form, and then have the Daily Dispatch Log form close the
QuickCall form. Then the Daily Dispatch Log form should requery itself
(Me.Requery) and then move to that new record:


Private Sub CmdQuickCall_Click()
Dim PrimKey as Variant
On Error GoTo Err_CmdQuickCall_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "QuickCall", , , , , acDialog
PrimKey =
Forms("QuickCall").Controls("NameOfControlBoundToP rimaryKeyField").Value
Me.Requery
With Me.RecordsetClone
.MoveFirst
' this code step is used if the primary key is a numeric field
.FindFirst "NameOfPrimaryKeyField = " & PrimKey
' this code step is used if the primary key is a text field
' .FindFirst "NameOfPrimaryKeyField = '" & PrimKey & "'"

' this code step is used if the primary key is a date field
' .FindFirst "NameOfPrimaryKeyField = #" & PrimKey & "#"
If .NoMatch = True Then
MsgBox "cannot find the newly entered record"
Else
Me.Bookmark = .Bookmark
End If
End With

Exit_CmdQuickCall_Click:
Exit Sub

Err_CmdQuickCall_Click:
MsgBox Err.Description
Resume Exit_CmdQuickCall_Click

End Sub


Then the close event procedure in QuickCall would be changed to this:

Private Sub CmdCloseForm_Click()
On Error GoTo Err_CmdCloseForm_Click
Me.Visible = False

Exit_CmdCloseForm_Click:
Exit Sub

Err_CmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_CmdCloseForm_Click

End Sub


Also, this procedure seems to have a redundant step:
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "QuickCall", , , , , acDialog
DoCmd.GoToRecord , , acNewRec
End Sub

It should be changed to this:
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub


--

Ken Snell
MS ACCESS MVP


"Jennifer P" wrote in message
...
These are the codes that I have. When I insert the Me.Requery I get an
error
message.

Private Sub CmdQuickCall_Click()
On Error GoTo Err_CmdQuickCall_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "QuickCall", , , , , acDialog
Me.Requery


Exit_CmdQuickCall_Click:
Exit Sub

Err_CmdQuickCall_Click:
MsgBox Err.Description
Resume Exit_CmdQuickCall_Click

End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "QuickCall", , , , , acDialog
DoCmd.GoToRecord , , acNewRec
End Sub

Private Sub OnScene_Click()
Me![On Scene] = Now()
End Sub
Private Sub CmdCloseForm_Click()
On Error GoTo Err_CmdCloseForm_Click


DoCmd.Close


Exit_CmdCloseForm_Click:
Exit Sub

Err_CmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_CmdCloseForm_Click

End Sub
Private Sub CmdRefresh_Click()
On Error GoTo Err_CmdRefresh_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_CmdRefresh_Click:
Exit Sub

Err_CmdRefresh_Click:
MsgBox Err.Description
Resume Exit_CmdRefresh_Click

End Sub


"Ken Snell [MVP]" wrote:

What is the code that runs when you click the "quick call button"? What
is
the code that runs in the popup form's Close event and in the "done
entering
data" button on the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
The form that is open is my Daily dispatch Log. It is used to track
all
calls. However if i am in the middle of a call I want to press the
quick
call button and fill in 5 fields and then close the form. The pop up
form
opens to the next availble record in the Daily Dispatch Log. The
problem
is
when I close the pop up form the Daily Dispatch log goes to record 1
and
does
not show that I have added a record. I need it to requery the Daily
Dispatch
Log so I can see the call I added with the Quick Call form. Now if I
close
the Daily Dispatch Log and reopen it, it shows the record I added.

Jen

"Ken Snell [MVP]" wrote:

Let me try asking my question in a different way.

In the form that is open all the time, you do something to cause the
popup
form to be opened. Click a button? Post the code that runs in order to
cause
the popup form to open.

--

Ken Snell
MS ACCESS MVP


"Jennifer P" wrote in message
...
Okay I understand that however I have the main form open all the
time
it
never closes. The pop form's information is not journaling to the
main
form
unless I close the main form then I can see it when I reopen it.

"Ken Snell [MVP]" wrote:

As I indicated in my first reply, this can be done by adding a
requery
step
to the code that is opening the form. Can you post the code that is
run
when
you click the button to open the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
Okay my pop up is working but the main form that the information
goes
to
is
not updating with the information from the pop up unless I close
it
and
open
it

"Ken Snell [MVP]" wrote:

How are you opening the popup form now?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in
message
...
Okay forgive me I am not that advance with Access YET...
I am not sure what "dialog mode" refers to

"Ken Snell [MVP]" wrote:

In the code that opens the popup form, after the line that
opens
the
form
(in dialog mode, right?), put a requery step for your current
form.

Something like this:
DoCmd.OpenForm "popup form", , , , , acDialog
Me.Requery

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in
message
...
I have a form call Daily Dispatch Log its table is also
Daily
Dispatch
Log.
I have a pop up form "Quick Call" that opens to a new
record
if
I
am
in
the
Daily Dispatch Log and allows me to put another record in
with.
(Officer,Call
Type, Location, License, State, On Scene). I created the
pop
up
form
so
if I
was in a call I could quickly add another record with out
having
to
leave
the
screen I was in. I need help in setting this pop up form
to
requery
the
information on the Daily Dispatch Log so I am not having to
close
it
out
to
see it on the main form "Daily Dispatch Log"

Thanks in advance Jen

















  #14  
Old April 5th, 2005, 06:59 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Sorry... I have left out a step in the "new" code that I posted for the
"calling" of the QuickCall form:

Private Sub CmdQuickCall_Click()
Dim PrimKey as Variant
On Error GoTo Err_CmdQuickCall_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "QuickCall", , , , , acDialog
PrimKey =
Forms("QuickCall").Controls("NameOfControlBoundToP rimaryKeyField").Value
DoCmd.Close acForm, "QuickCall", acSaveNo
Me.Requery
With Me.RecordsetClone
.MoveFirst
' this code step is used if the primary key is a numeric field
.FindFirst "NameOfPrimaryKeyField = " & PrimKey
' this code step is used if the primary key is a text field
' .FindFirst "NameOfPrimaryKeyField = '" & PrimKey & "'"

' this code step is used if the primary key is a date field
' .FindFirst "NameOfPrimaryKeyField = #" & PrimKey & "#"
If .NoMatch = True Then
MsgBox "cannot find the newly entered record"
Else
Me.Bookmark = .Bookmark
End If
End With

Exit_CmdQuickCall_Click:
Exit Sub

Err_CmdQuickCall_Click:
MsgBox Err.Description
Resume Exit_CmdQuickCall_Click

End Sub


--

Ken Snell
MS ACCESS MVP

"Ken Snell [MVP]" wrote in message
...
It will help us here if you identify which code is in which form...

I am assuming that CmdQuickCall_Click is in the main form (your Daily
Dispatch Log form); and that all the other code is from the popup form
(your QuickCall form)? Is this correct?

What error message do you get from the Me.Requery step?

Are you in the middle of entering/editing a record on the Daily Dispatch
Log form when you click the QuickCall button? It appears that you use the
QuickCall form to enter a new record that is to be displayed on the Daily
Dispatch Log form after it's entered. Is the Daily Dispatch Log form
filtered in any way? Does the QuickCall form have the same filter so that
the entry you make would show on the Daily Dispatch Log form if it had
already been there?

Note that the Me.Requery step will indeed put the form back at the "first"
record. It appears that you want the form to "move" to the newly entered
record (the one entered via the QuickCall form)? If yes, it'll be
necessary for the Daily Dispatch Log form to know what the primary key
value is for the newly entered form. This can be done if you don't close
QuickCall form, but instead make it invisible (after saving its current
record), let the code in the Daily Dispatch Log form read the primary key
value from the QuickCall form, and then have the Daily Dispatch Log form
close the QuickCall form. Then the Daily Dispatch Log form should requery
itself (Me.Requery) and then move to that new record:


Private Sub CmdQuickCall_Click()
Dim PrimKey as Variant
On Error GoTo Err_CmdQuickCall_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "QuickCall", , , , , acDialog
PrimKey =
Forms("QuickCall").Controls("NameOfControlBoundToP rimaryKeyField").Value
Me.Requery
With Me.RecordsetClone
.MoveFirst
' this code step is used if the primary key is a numeric field
.FindFirst "NameOfPrimaryKeyField = " & PrimKey
' this code step is used if the primary key is a text field
' .FindFirst "NameOfPrimaryKeyField = '" & PrimKey & "'"

' this code step is used if the primary key is a date field
' .FindFirst "NameOfPrimaryKeyField = #" & PrimKey & "#"
If .NoMatch = True Then
MsgBox "cannot find the newly entered record"
Else
Me.Bookmark = .Bookmark
End If
End With

Exit_CmdQuickCall_Click:
Exit Sub

Err_CmdQuickCall_Click:
MsgBox Err.Description
Resume Exit_CmdQuickCall_Click

End Sub


Then the close event procedure in QuickCall would be changed to this:

Private Sub CmdCloseForm_Click()
On Error GoTo Err_CmdCloseForm_Click
Me.Visible = False

Exit_CmdCloseForm_Click:
Exit Sub

Err_CmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_CmdCloseForm_Click

End Sub


Also, this procedure seems to have a redundant step:
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "QuickCall", , , , , acDialog
DoCmd.GoToRecord , , acNewRec
End Sub

It should be changed to this:
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub


--

Ken Snell
MS ACCESS MVP


"Jennifer P" wrote in message
...
These are the codes that I have. When I insert the Me.Requery I get an
error
message.

Private Sub CmdQuickCall_Click()
On Error GoTo Err_CmdQuickCall_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "QuickCall", , , , , acDialog
Me.Requery


Exit_CmdQuickCall_Click:
Exit Sub

Err_CmdQuickCall_Click:
MsgBox Err.Description
Resume Exit_CmdQuickCall_Click

End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "QuickCall", , , , , acDialog
DoCmd.GoToRecord , , acNewRec
End Sub

Private Sub OnScene_Click()
Me![On Scene] = Now()
End Sub
Private Sub CmdCloseForm_Click()
On Error GoTo Err_CmdCloseForm_Click


DoCmd.Close


Exit_CmdCloseForm_Click:
Exit Sub

Err_CmdCloseForm_Click:
MsgBox Err.Description
Resume Exit_CmdCloseForm_Click

End Sub
Private Sub CmdRefresh_Click()
On Error GoTo Err_CmdRefresh_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_CmdRefresh_Click:
Exit Sub

Err_CmdRefresh_Click:
MsgBox Err.Description
Resume Exit_CmdRefresh_Click

End Sub


"Ken Snell [MVP]" wrote:

What is the code that runs when you click the "quick call button"? What
is
the code that runs in the popup form's Close event and in the "done
entering
data" button on the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in message
...
The form that is open is my Daily dispatch Log. It is used to track
all
calls. However if i am in the middle of a call I want to press the
quick
call button and fill in 5 fields and then close the form. The pop up
form
opens to the next availble record in the Daily Dispatch Log. The
problem
is
when I close the pop up form the Daily Dispatch log goes to record 1
and
does
not show that I have added a record. I need it to requery the Daily
Dispatch
Log so I can see the call I added with the Quick Call form. Now if I
close
the Daily Dispatch Log and reopen it, it shows the record I added.

Jen

"Ken Snell [MVP]" wrote:

Let me try asking my question in a different way.

In the form that is open all the time, you do something to cause the
popup
form to be opened. Click a button? Post the code that runs in order
to
cause
the popup form to open.

--

Ken Snell
MS ACCESS MVP


"Jennifer P" wrote in message
...
Okay I understand that however I have the main form open all the
time
it
never closes. The pop form's information is not journaling to the
main
form
unless I close the main form then I can see it when I reopen it.

"Ken Snell [MVP]" wrote:

As I indicated in my first reply, this can be done by adding a
requery
step
to the code that is opening the form. Can you post the code that
is
run
when
you click the button to open the popup form?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in
message
...
Okay my pop up is working but the main form that the information
goes
to
is
not updating with the information from the pop up unless I close
it
and
open
it

"Ken Snell [MVP]" wrote:

How are you opening the popup form now?

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in
message
...
Okay forgive me I am not that advance with Access YET...
I am not sure what "dialog mode" refers to

"Ken Snell [MVP]" wrote:

In the code that opens the popup form, after the line that
opens
the
form
(in dialog mode, right?), put a requery step for your
current
form.

Something like this:
DoCmd.OpenForm "popup form", , , , , acDialog
Me.Requery

--

Ken Snell
MS ACCESS MVP

"Jennifer P" wrote in
message
...
I have a form call Daily Dispatch Log its table is also
Daily
Dispatch
Log.
I have a pop up form "Quick Call" that opens to a new
record
if
I
am
in
the
Daily Dispatch Log and allows me to put another record in
with.
(Officer,Call
Type, Location, License, State, On Scene). I created the
pop
up
form
so
if I
was in a call I could quickly add another record with out
having
to
leave
the
screen I was in. I need help in setting this pop up form
to
requery
the
information on the Daily Dispatch Log so I am not having
to
close
it
out
to
see it on the main form "Daily Dispatch Log"

Thanks in advance Jen



















 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform on an unbound main form Chuck Using Forms 1 February 2nd, 2005 11:32 PM
Need to clear controls of Filter form Jan Il Using Forms 2 November 28th, 2004 02:04 PM
Strange stLinkCriteria behaviour on command button Anthony Dowd Using Forms 3 August 21st, 2004 03:01 AM
dlookup miaplacidus Using Forms 9 August 5th, 2004 09:16 PM
auto entry into second table after update Tony New Users 13 July 9th, 2004 10:42 PM


All times are GMT +1. The time now is 03:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.