Details section is scrolling when insert new record

Dear all,

I have header and details forms, let say frmInvoiceMain and frmInvoiceDetail
In header form , I have field User Modified and Date Modified.
In details form (frmInvoiceDetails), I have code like below :

Private Sub Form_AfterUpdate()

   UpdateRecordStatus Me.Parent!InvoiceNo
End Sub

Private Sub UpdateRecordStatus(strInvoiceNo As String)
   Dim strSQL As String
   Dim rst As DAO.Recordset
   Dim db As DAO.Database

   strSQL = "SELECT UserModified, DateModified "
   strSQL = strSQL & "FROM tblInvoiceMain WHERE InvoiceNo= '" & strInvoiceNo 
& "'"

   Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
   With rst
      If Not .EOF Then
         .Edit
         !UserModified = CurrentUser
         !DateModified = Now
         .Update
      End If
   End With
   rst.Close
   Set rst = Nothing
End Sub

The problem is every time the user insert record in details section, then 
the form (frmInvoiceDetail) will scroll up.
How to prevent the form from scrolling ?

Many thanks before.

Chlaris. 


0
Chlaris
9/28/2007 10:12:39 AM
access 16762 articles. 3 followers. Follow

2 Replies
631 Views

Similar Articles

[PageSpeed] 9

Why not just update the Controls on the Parent Form?

Dim PF As Access.Form
Set PF = Me.Parent
With PF
  .UserModified.Value = Access.CurrentUser()
  .DateModified.Value = VBA.Now()
  ' .Dirty = False
End With

Set PF = Nothing

HTH

Pieter


"Chlaris" <chlarrissa_nospam@yahoo.com> wrote in message 
news:ur0AcgbAIHA.4444@TK2MSFTNGP03.phx.gbl...
> Dear all,
>
> I have header and details forms, let say frmInvoiceMain and 
> frmInvoiceDetail
> In header form , I have field User Modified and Date Modified.
> In details form (frmInvoiceDetails), I have code like below :
>
> Private Sub Form_AfterUpdate()
>
>   UpdateRecordStatus Me.Parent!InvoiceNo
> End Sub
>
> Private Sub UpdateRecordStatus(strInvoiceNo As String)
>   Dim strSQL As String
>   Dim rst As DAO.Recordset
>   Dim db As DAO.Database
>
>   strSQL = "SELECT UserModified, DateModified "
>   strSQL = strSQL & "FROM tblInvoiceMain WHERE InvoiceNo= '" & 
> strInvoiceNo & "'"
>
>   Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
>   With rst
>      If Not .EOF Then
>         .Edit
>         !UserModified = CurrentUser
>         !DateModified = Now
>         .Update
>      End If
>   End With
>   rst.Close
>   Set rst = Nothing
> End Sub
>
> The problem is every time the user insert record in details section, then 
> the form (frmInvoiceDetail) will scroll up.
> How to prevent the form from scrolling ?
>
> Many thanks before.
>
> Chlaris.
> 


0
Pieter
9/28/2007 10:26:50 AM
Pieter,

Thanks for your code. It works perfectly. The subform is not scrolling 
anymore.

Regards,
Chlaris

"Pieter Wijnen" 
<it.isi.llegal.to.send.unsollicited.mail.wijnen.nospam.please@online.replace.with.norway> 
wrote in message news:ef08nnbAIHA.4584@TK2MSFTNGP03.phx.gbl...
> Why not just update the Controls on the Parent Form?
>
> Dim PF As Access.Form
> Set PF = Me.Parent
> With PF
>  .UserModified.Value = Access.CurrentUser()
>  .DateModified.Value = VBA.Now()
>  ' .Dirty = False
> End With
>
> Set PF = Nothing
>
> HTH
>
> Pieter
>
>
> "Chlaris" <chlarrissa_nospam@yahoo.com> wrote in message 
> news:ur0AcgbAIHA.4444@TK2MSFTNGP03.phx.gbl...
>> Dear all,
>>
>> I have header and details forms, let say frmInvoiceMain and 
>> frmInvoiceDetail
>> In header form , I have field User Modified and Date Modified.
>> In details form (frmInvoiceDetails), I have code like below :
>>
>> Private Sub Form_AfterUpdate()
>>
>>   UpdateRecordStatus Me.Parent!InvoiceNo
>> End Sub
>>
>> Private Sub UpdateRecordStatus(strInvoiceNo As String)
>>   Dim strSQL As String
>>   Dim rst As DAO.Recordset
>>   Dim db As DAO.Database
>>
>>   strSQL = "SELECT UserModified, DateModified "
>>   strSQL = strSQL & "FROM tblInvoiceMain WHERE InvoiceNo= '" & 
>> strInvoiceNo & "'"
>>
>>   Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
>>   With rst
>>      If Not .EOF Then
>>         .Edit
>>         !UserModified = CurrentUser
>>         !DateModified = Now
>>         .Update
>>      End If
>>   End With
>>   rst.Close
>>   Set rst = Nothing
>> End Sub
>>
>> The problem is every time the user insert record in details section, then 
>> the form (frmInvoiceDetail) will scroll up.
>> How to prevent the form from scrolling ?
>>
>> Many thanks before.
>>
>> Chlaris.
>>
>
> 


0
Chlaris
9/29/2007 2:07:49 AM
Reply:

Similar Artilces:

Add new user in CRM 3.0
On a new system, using the web interface to add a new user, ust after putting in domain\username I get the message "An error has occurred. For more information contact your system admnistrator" - no info from AD is displayed. Using the Deployment Manager, I never manage to get any domains or users listed. This leaves me unable to add users at all.. Single Domain: Win2003 with AD. SQL 2005 Svr SP1 Any help would be appreciated.. You might go to the web.config file in the CRM root folder and set remote errors to Off so you can get an informative error message. -- Matt Wittema...

old email addresses replaced by new will not allow owa access
Hello all, We have changed our email format from first initial last@XXX.com with firstname.lastname@XXX.com I went to remove the old email address for my account. once I did that I was not able to access OWA. Any thoughts? Thank you in advance. How do you log on to OWA? -- Ed Crowley MVP "There are seldom good technological solutions to behavioral problems." .. "Rollin West" <Rollin West@discussions.microsoft.com> wrote in message news:BF891802-5928-4E91-9F64-1AC93EB6E45A@microsoft.com... > Hello all, > > We have changed our ema...

Insert Code
I have some VBA code that I would like to insert into an excel worksheet With ActiveCell.Columns .EntireColumn.Copy .EntireColumn.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End With Application.CutCopyMode = False I thought all I would have to do is create a macro, use the macro editor and paste in this code instead and run that macro, and this code would run instead.....Thats not working.......how do i run this code?? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/excel-new/200510/1 Try this .....

Inserting A Blank Line, Again
Below is an example of text data imported into Excel. Would it be possible to insert a blank line between the different races times as displayed below? Again, the data varies. The data is imported into A2. There is other data in columns B & C. I am able to sort the times with the help of Pete (UK). 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 1:40Newton Abbot 2:05Kempton 2:05Kempton 2:05Kempton 2:05Kempton 2:05Kempton 2:05Kempton 2:05Kempton 2:05Kempton 2:10Newton Abbot 2:10Ne...

Extra lines inserting in replies/forwards
Hi When I reply or forward Outlook messages, I'm getting about 20 lines (blank) put in between the replied/forwarded message "Subject" line and the text. Can anyone help me to stop this? Thanks. David "DG" <dgee@papercontracts.co.uk> wrote in message news:OGJgUTPoFHA.3552@TK2MSFTNGP10.phx.gbl... > Hi > When I reply or forward Outlook messages, I'm getting about 20 lines > (blank) put in between the replied/forwarded message "Subject" line and > the text. Can anyone help me to stop this? Thanks. David > Is it set to reply...

new contact list
hello, i got an email that was sent to several emails (i was one of a contac list). how can i make a new contact list of my own with all the emails tha got that email. thank ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ...

Execute a variable as an insertion into a VBA code line
2003 & 2007 Is there a way to obtain, via Inputbox, to run the code line below: "MyToolsObject.Test" X = "MyToolsObject." & Application.InputBox("VB.NET File to test: ", "ENTER PROCEDURE NAME") Assume: X = "MyToolsObject.Test " Effectively, how can I "Execute" X as if it were the codeline below? Sub DecodeRunDLL() ' Dim MyToolsObject As ToolsNET.Tools Set MyToolsObject = New ToolsNET.Tools MyToolsObject.Test ' <<<<< *********** ...

importing email to a new computer
Hi, I'm trying to move a substantial amount of emails from a PC to my new lap top. As the size of the email folder is larger than one CDROM I can only copy specific files at a time. However, when I try to import these files, the program does not recognize them. Any hints on how simply to move my emails from one computer to another? Best, Cameron Outlook or Outlook Express? Outlook 97/98/2000/2002/2003: http://www.slipstick.com/config/backup.htm Outlook & Exchange/Windows Messaging Backup and Dual-Boot Outlook Express: Backing Up, Recovering and Restoring OE5/6 Files a...

Inserting a 'Standard'
Hello Wizards I've got my bar or line graph. Is there a clean way to place a 'standard' or 'goal' line on the graph. i.e. if I want the goal to be 18.7 can I get that to be a horizontal line that stands out. TIA ! Sam Would using the drawing toolbar to manually insert a line, possibly with some descriptive text, work? "Metolius Dad" wrote: > Hello Wizards > > I've got my bar or line graph. Is there a clean way to place a 'standard' > or 'goal' line on the graph. i.e. if I want the goal to be 18.7 can I get > that ...

MX Records not showing correctly
Could someone explain why I am getting the following and what I can do to resolve this problem. *** computername.domain.com can't find query=mx: Non-existent domain > query=mx domain.com Server: domain.com Addresses: 192.168.1.10, 192.168.0.10 *** domain.com can't find query=mx: Non-existent domain > query=mx 192.168.0.10 Server: [192.168.0.10] Address: 192.168.0.10 *** 192.168.0.10 can't find query=mx: Non-existent domain > Thanks for you help Terry You don't need MX records on internal DNS. What exactly are you trying to do? If you are trying to...

counting records shown in a report
greetings to all I have a report bound to a query called qAttendance. The report has its Filter property set to limit the records showing in the Detail section. So far so good. In the report footer, i want to show the count or records in the report. How do I do this?? (I can get a count in forms using recordsetclone and bookmarks, but I can't figure out a good method for reports) Becky oops. Got it using DCount. "Becky" wrote: > greetings to all > > I have a report bound to a query called qAttendance. The report has its > Filter pro...

Possible to view spreadsheets without scroll bars?
Hi all. I have a question regarding large spreadsheets. I want it to look very professional and ideally would like the user to view it on the screen rather then having to scroll down and then across at various points! Any way to achieve this? Any suggestions regarding a way in which to make spreadsheet more professional are very welcome. Thank you! -- londonchick ------------------------------------------------------------------------ londonchick's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24529 View this thread: http://www.excelforum.com/showthread.php?...

Where is the Object section?
I need to put a sub command into the object section for a formula to work. However i am not understanding what or where the object or object section is. Does anyone know where it is? Hi, Maybe it would be best to explain what your trying to do. -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "gudencough" wrote: > I need to put a sub command into the object section for a formula to work. > However i am not understanding what or where t...

Protect Worksheet but allow to insert or delete rows
I have set up a worksheet, locked and unlocked cells as needed and I want to allow the user to insert and delete rows. But, when I set protection and tick "Insert Rows" and tick "Delete Rows"; the menu only will allow "Insert Rows", the "Delete Rows" field is not accessible. Solution? Do you get an error message saying that you can't delete the row since there are locked cells on that row? I do when I protect a worksheet using your options and then rightclick on a row number and choose delete. (And that row contains locked cells.) Bob L Hill...

New Tabs open Randomly
I am running XP Home (SP3) In the last few days I have had new tabs open randomly under my open tab. Can anyone tell me why this is happening and how to prevent it? Thank you. ...

Section 179 Depreciation
I would like to suggest adding the Section 179 Expense Deduction to the Depreciation Ledgers and to Smartlist. I know I can modify each Depreciation Ledger to include it but that takes some rearranging of columns. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. htt...

Scroll down on Form, not to next record
I have a data entry form that is just a little longer than the page. I have used http://www.lebans.com/mousewheelonoff.htm and it works very well at totally disabling the mouse scroll. What I want to know is how can I get the scroll button on the mouse to actually scroll down on the current record on the form? Not to the next one. This would be so helpful for me. Thanks. Either the scroll wheel is off or on! -- www.ae911truth.org "This Guy" wrote: > I have a data entry form that is just a little longer than the page. I have > used > > http://www.le...

Totals for records with same order #
I work for a small mail order company and I'm trying to get a estimate of our shipping costs. If we get a order for 6 items and we only have 4 in stock, we will ship the 4 and backorder the other 2. The table structure looks like this: Order#, Weight, ShipDate, Cost. I need a query that will tell me the total shippng cost for each order. I other words, if we have two shipments for Order# 40314 and the first shipment cost 6.95 and the second cost 5.95 I want a query where the results look like this: Order # Cost 40314 12.90 Thanks in advance Jim "James D. H...

Outlook 2003 (Creating new email)
I have been creating new email for several months now using Outlook 2003. While I was creating some new rules for emails, I must have changed a setting. Now when I attempt to create a new email, it pulls up a template with wierd fonts, some of my typing doesn't show up on my screen as I am inputting, my signature I had created doesn't show up, and it has a different feel than the before? Any idea what I have done and what I should do to restore my previous settings? ...

new emails that are really a month old that reload every few minutes
Help. Every few minutes, I have to delete 28 "new" emails...this is a brand new problem that started yesterday. The same emails from October keep showing up as new very few minutes...I've had to delete hundreds of emails today. Why is this happening? Is there some reason you aren't deleting messages from the POP server after downloading them? Allison wrote: > Help. Every few minutes, I have to delete 28 "new" > emails...this is a brand new problem that started > yesterday. The same emails from October keep showing up > as new very few minutes....

Eliminating duplicate records in consecutive rows of a column
Eliminating duplicate records in consecutive rows of a column I have an Excel spread sheet that has 6,000 rows of text in one of the columns. I want to be able to eliminate duplicate records. Can this task be done automatically? In additional to posting your solution to this group, can you please cc: me at lpsca@earthlink.net Sub test() 'Assumes your data is in Column B Application.ScreenUpdating = False 'Amend range as necessary Range("B1:B6000").AdvancedFilter Action:=xlFilterCopy, _ CopyToRange:=Range("C1"), Unique:=True Columns("C:C").Copy Range(&q...

Installation of Publisher 2002 on my new computer
I recently upgraded to a new computer. I would like to install Publisher on this new computer, but it rejects my product key. Can I uninstall Publisher from my old computer and then install it on the new computer and if so, how? Uninstall the program on the first computer, use the phone number on the activation page and explain... -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Barnie" <Barnie@discussions.microsoft.com> wrote in message news:2FDB7BAD-0416-4049-858C-78AF0780F7F0@microsoft.com... >I recently upg...

recording closing costs of a home sale
We have recently sold our house. How should we record this is Money (Money Plus)? I had an escrow account along with the home loan account. I think I can close out escrow. But how do I record the settlement money from closing? Do I categorize the tax paid from closing? real estate agent fees? Or can I be lazy and just write-in the sale price as (mortgage principle + cash received after all closing costs have been paid)? Then should I close the asset account that was our home residence? Or can I change this asset account to the estimated value of our new home? thanks in advance, ...

Insert Object in PP2003
What is the purpose of object in insert menu and how to work on it, please advice Christopher Fernando In article <52955C83-9B41-4D37-9643-2D3B8B513A00@microsoft.com>, Chris Fernando wrote: > What is the purpose of object in insert menu and how to work on it, please > advice With some types of data or programs, you can insert an "OBJECT" into a PPT slide; when you doubleclick the slide, the data opens in the appropriate program so you can edit or play it back. For example, if you insert a picture normally into PowerPoint, you can only resize and r...

MS SQL Insert Data from One table to another
Hi guys, After seeing the benefits one can derived in developing applications running on sql, I have tried my hands on some small application, but with some challenges, and I will be grateful if someone can help me out. I want the contents one table to be added to some specific fields in another table. for eg. Table 1 P_Id pMonth pYear pRegistrar pFormType pCasetype ..... table 2 fID FormName 1 Land 2 Commercial 3 Defamation .... ..... I want to insert the values of table 2 to table 1 spec...