PC Review


Reply
Thread Tools Rate Thread

Requery form does not maintain other forms record position

 
 
Rachel
Guest
Posts: n/a
 
      24th Jul 2008
Hi,

I have a bit of a problem, I have a form called frm_Search and on this
form I have a command button which opens a popup form (frm_Invoice), I
have a command button on the popup form also, which when pressed re-
query's the form 'frm_Search'. This is to ensure that data entered
(frm_Invoice) is displayed in the 'frm_search' form.

However, once it has re-queried the record position (on the frm_Search
form) goes back to the first record and not the record that has been
updated via the frm_Invoice popup form.

I understand from reading up on this issue, that when something is re-
queried the bookmark doesn't work.

I am totally lost with this now and any help would be greatly
appreciated.

This is my code from the popup form command button (frm_Invoice):

Private Sub cmd_Save_Invoice_Click()

On Error GoTo Err_cmd_Save_Invoice_Click

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Forms!frm_Search.Requery

Exit_cmd_Save_Invoice_Click:
Exit Sub

Err_cmd_Save_Invoice_Click:
MsgBox Err.Description
Resume Exit_cmd_Save_Invoice_Click

End Sub

This is my code from the command button on the frm_Search form (which
opens the popup form):

Private Sub cmd_Invoice_Click()
On Error GoTo Err_cmd_Invoice_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_Invoice"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmd_Invoice_Click:
Exit Sub

Err_cmd_Invoice_Click:
MsgBox Err.Description
Resume Exit_cmd_AddInvoice_Click

End Sub

Many Thanks

Rachel
 
Reply With Quote
 
 
 
 
Sylvain Lafontaine
Guest
Posts: n/a
 
      24th Jul 2008
Yes, your code must remember the value of the primary key for the current
row and use it to reposition it after the requery. Search this newsgroup
for Recordset.Clone for many example of how to reposition a form to a
specific row.

(Finally, a personal opinion here: the use of prefixes such as frm_ and the
use of the underline character in a name is a bad habit that most people
around here have ceased; as they both make your code harder to read by other
people.)

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


"Rachel" <(E-Mail Removed)> wrote in message
news:b3420976-862f-49f1-90a4-(E-Mail Removed)...
> Hi,
>
> I have a bit of a problem, I have a form called frm_Search and on this
> form I have a command button which opens a popup form (frm_Invoice), I
> have a command button on the popup form also, which when pressed re-
> query's the form 'frm_Search'. This is to ensure that data entered
> (frm_Invoice) is displayed in the 'frm_search' form.
>
> However, once it has re-queried the record position (on the frm_Search
> form) goes back to the first record and not the record that has been
> updated via the frm_Invoice popup form.
>
> I understand from reading up on this issue, that when something is re-
> queried the bookmark doesn't work.
>
> I am totally lost with this now and any help would be greatly
> appreciated.
>
> This is my code from the popup form command button (frm_Invoice):
>
> Private Sub cmd_Save_Invoice_Click()
>
> On Error GoTo Err_cmd_Save_Invoice_Click
>
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
> acMenuVer70
> Forms!frm_Search.Requery
>
> Exit_cmd_Save_Invoice_Click:
> Exit Sub
>
> Err_cmd_Save_Invoice_Click:
> MsgBox Err.Description
> Resume Exit_cmd_Save_Invoice_Click
>
> End Sub
>
> This is my code from the command button on the frm_Search form (which
> opens the popup form):
>
> Private Sub cmd_Invoice_Click()
> On Error GoTo Err_cmd_Invoice_Click
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "frm_Invoice"
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> Exit_cmd_Invoice_Click:
> Exit Sub
>
> Err_cmd_Invoice_Click:
> MsgBox Err.Description
> Resume Exit_cmd_AddInvoice_Click
>
> End Sub
>
> Many Thanks
>
> Rachel



 
Reply With Quote
 
 
 
 
Rachel
Guest
Posts: n/a
 
      25th Jul 2008
On Jul 24, 7:38*pm, "Sylvain Lafontaine" <sylvain aei ca (fill the
blanks, no spam please)> wrote:
> Yes, your code must remember the value of the primary key for the current
> row and use it to reposition it after the requery. *Search this newsgroup
> for Recordset.Clone for many example of how to reposition a form to a
> specific row.
>
> (Finally, a personal opinion here: the use of prefixes such as frm_ and the
> use of the underline character in a name is a bad habit that most people
> around here have ceased; as they both make your code harder to read by other
> people.)
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: sylvain aei ca (fill the blanks, no spam please)
>
> "Rachel" <curran_rac...@hotmail.com> wrote in message
>
> news:b3420976-862f-49f1-90a4-(E-Mail Removed)...
>
>
>
> > Hi,

>
> > I have a bit of a problem, I have a form called frm_Search and on this
> > form I have a command button which opens a popup form (frm_Invoice), I
> > have a command button on the popup form also, which when pressed re-
> > query's the form 'frm_Search'. *This is to ensure that data entered
> > (frm_Invoice) is displayed in the 'frm_search' form.

>
> > However, once it has re-queried the record position (on the frm_Search
> > form) goes back to the first record and not the record that has been
> > updated via the frm_Invoice popup form.

>
> > I understand from reading up on this issue, that when something is re-
> > queried the bookmark doesn't work.

>
> > I am totally lost with this now and any help would be greatly
> > appreciated.

>
> > This is my code from the popup form command button (frm_Invoice):

>
> > Private Sub cmd_Save_Invoice_Click()

>
> > On Error GoTo Err_cmd_Save_Invoice_Click

>
> > * *DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
> > acMenuVer70
> > * *Forms!frm_Search.Requery

>
> > Exit_cmd_Save_Invoice_Click:
> > * *Exit Sub

>
> > Err_cmd_Save_Invoice_Click:
> > * *MsgBox Err.Description
> > * *Resume Exit_cmd_Save_Invoice_Click

>
> > End Sub

>
> > This is my code from the command button on the frm_Search form (which
> > opens the popup form):

>
> > Private Sub cmd_Invoice_Click()
> > On Error GoTo Err_cmd_Invoice_Click

>
> > * *Dim stDocName As String
> > * *Dim stLinkCriteria As String

>
> > * *stDocName = "frm_Invoice"
> > * *DoCmd.OpenForm stDocName, , , stLinkCriteria

>
> > Exit_cmd_Invoice_Click:
> > * *Exit Sub

>
> > Err_cmd_Invoice_Click:
> > * *MsgBox Err.Description
> > * *Resume Exit_cmd_AddInvoice_Click

>
> > End Sub

>
> > Many Thanks

>
> > Rachel- Hide quoted text -

>
> - Show quoted text -


Thanks, how would you suggest I name the forms if I do not use frm_?

Many thanks

Rachel
 
Reply With Quote
 
boblarson
Guest
Posts: n/a
 
      25th Jul 2008
I personally disagree about not using frm in the name of the form. I find
it helps me identify my objects faster and easier. I do not like using the
underscore though. I will use frmMyFormName or rptMyReportName, etc. in
order to quickly identify what I am working with.

--

Bob Larson
Access MVP
Access World Forums Administrator
Utter Access VIP
Free Access Resources at http://www.btabdevelopment.com


"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:uF%(E-Mail Removed)...
> Yes, your code must remember the value of the primary key for the current
> row and use it to reposition it after the requery. Search this newsgroup
> for Recordset.Clone for many example of how to reposition a form to a
> specific row.
>
> (Finally, a personal opinion here: the use of prefixes such as frm_ and
> the use of the underline character in a name is a bad habit that most
> people around here have ceased; as they both make your code harder to read
> by other people.)
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: sylvain aei ca (fill the blanks, no spam please)
>
>
> "Rachel" <(E-Mail Removed)> wrote in message
> news:b3420976-862f-49f1-90a4-(E-Mail Removed)...
>> Hi,
>>
>> I have a bit of a problem, I have a form called frm_Search and on this
>> form I have a command button which opens a popup form (frm_Invoice), I
>> have a command button on the popup form also, which when pressed re-
>> query's the form 'frm_Search'. This is to ensure that data entered
>> (frm_Invoice) is displayed in the 'frm_search' form.
>>
>> However, once it has re-queried the record position (on the frm_Search
>> form) goes back to the first record and not the record that has been
>> updated via the frm_Invoice popup form.
>>
>> I understand from reading up on this issue, that when something is re-
>> queried the bookmark doesn't work.
>>
>> I am totally lost with this now and any help would be greatly
>> appreciated.
>>
>> This is my code from the popup form command button (frm_Invoice):
>>
>> Private Sub cmd_Save_Invoice_Click()
>>
>> On Error GoTo Err_cmd_Save_Invoice_Click
>>
>> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
>> acMenuVer70
>> Forms!frm_Search.Requery
>>
>> Exit_cmd_Save_Invoice_Click:
>> Exit Sub
>>
>> Err_cmd_Save_Invoice_Click:
>> MsgBox Err.Description
>> Resume Exit_cmd_Save_Invoice_Click
>>
>> End Sub
>>
>> This is my code from the command button on the frm_Search form (which
>> opens the popup form):
>>
>> Private Sub cmd_Invoice_Click()
>> On Error GoTo Err_cmd_Invoice_Click
>>
>> Dim stDocName As String
>> Dim stLinkCriteria As String
>>
>> stDocName = "frm_Invoice"
>> DoCmd.OpenForm stDocName, , , stLinkCriteria
>>
>> Exit_cmd_Invoice_Click:
>> Exit Sub
>>
>> Err_cmd_Invoice_Click:
>> MsgBox Err.Description
>> Resume Exit_cmd_AddInvoice_Click
>>
>> End Sub
>>
>> Many Thanks
>>
>> Rachel

>
>



 
Reply With Quote
 
kazanç evi
Guest
Posts: n/a
 
      18th Aug 2008
Dell all our best deals
Dell toutes nos meilleurs offres
Dell alle unsere Top-Angebote
Dell todas nuestras mejores ofertas
Dell alle vores bedste tilbud
Dell kaikki parhaamme käsitellään
Dell tutte le nostre migliori offerte
???????????
???????????
?? ?? ??? ??
Dell ??? ?? ???? ?? ???? ???????

http://www1.euro.dell.com/content/de...676&lid=137598



"Rachel" <(E-Mail Removed)> a écrit dans le message de
news:b3420976-862f-49f1-90a4-(E-Mail Removed)...
> Hi,
>
> I have a bit of a problem, I have a form called frm_Search and on this
> form I have a command button which opens a popup form (frm_Invoice), I
> have a command button on the popup form also, which when pressed re-
> query's the form 'frm_Search'. This is to ensure that data entered
> (frm_Invoice) is displayed in the 'frm_search' form.
>
> However, once it has re-queried the record position (on the frm_Search
> form) goes back to the first record and not the record that has been
> updated via the frm_Invoice popup form.
>
> I understand from reading up on this issue, that when something is re-
> queried the bookmark doesn't work.
>
> I am totally lost with this now and any help would be greatly
> appreciated.
>
> This is my code from the popup form command button (frm_Invoice):
>
> Private Sub cmd_Save_Invoice_Click()
>
> On Error GoTo Err_cmd_Save_Invoice_Click
>
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
> acMenuVer70
> Forms!frm_Search.Requery
>
> Exit_cmd_Save_Invoice_Click:
> Exit Sub
>
> Err_cmd_Save_Invoice_Click:
> MsgBox Err.Description
> Resume Exit_cmd_Save_Invoice_Click
>
> End Sub
>
> This is my code from the command button on the frm_Search form (which
> opens the popup form):
>
> Private Sub cmd_Invoice_Click()
> On Error GoTo Err_cmd_Invoice_Click
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "frm_Invoice"
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> Exit_cmd_Invoice_Click:
> Exit Sub
>
> Err_cmd_Invoice_Click:
> MsgBox Err.Description
> Resume Exit_cmd_AddInvoice_Click
>
> End Sub
>
> Many Thanks
>
> Rachel


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to requery w DataGridView and maintain context? RBarryYoung@gmail.com Microsoft Dot NET Framework Forms 1 28th Jan 2008 04:15 PM
Requery issue : Application closes on form.requery.... =?Utf-8?B?c3VyeWE=?= Microsoft Access Form Coding 3 6th Nov 2006 09:58 PM
Maintain scroll position on postback does not work when files are deployed to remote server Keithb Microsoft ASP .NET 0 28th Oct 2006 11:09 PM
Requery the 1st requery result which displayed in form vincentt via AccessMonster.com Microsoft Access 2 31st Aug 2006 03:49 AM
Form position based on another forms position =?Utf-8?B?R3JlZ29yeQ==?= Microsoft Access Forms 3 13th Nov 2003 02:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:06 PM.