473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Cursor position in subform

44
Hello, I am facing a strange problem, I've looked everywhere for a solution but couldn't find any previous posts about it. I will try to explain as best as I can, but it's quite hard to describe.

I have a subform with 5 fields. On the first of these fields “Date”I put in code triggered by On UpDate event so that after writing a new date in the subform some calculations are performed.
So far everything works fine. My problem is that when I go back to a new record and focus the cursor again in the empty Date field, automatically the cursor moves to the first record (within the subform) of the same field (Date). It seems I can do nothing to stop it.
Any help would be much appreciated.
Jun 29 '16 #1
5 1895
TheSmileyCoder
2,322 Expert Mod 2GB
Does your code include a requery call? A requery call will set the cursor at the first record.

Which event exactly are you using? I am confused as there is no On Update event. There is a before update, After update, and On Change.
Jun 29 '16 #2
David57
44
Sorry I didn't explain correctly.
The code does not include a requery call and the event I am using is After update.

David
Jun 29 '16 #3
jimatqsi
1,271 Expert 1GB
David, please explain more clearly what you are doing prior to the problem. It sounds like you edited the date of an existing record and that went well. Then you immediately clicked on the empty date field in a new row, not an existing row. Is that right?

Are you doing anything in the sub-form's OnCurrent event or any other events of the Form (sub-form)?
Jun 29 '16 #4
TheSmileyCoder
2,322 Expert Mod 2GB
Could you post the code of the afterupdate event? Do you have any other code related to that specific date control, such as an OnGotFocus event or?
Jun 29 '16 #5
David57
44
I didn’t edit any existing date but I entered a new one. The problem arises when having finished putting data in all the fields, I focus the cursor in the field “Date” of a new empty record just to end the operation.
Please understand that my knowledge of Access VBA is really rather basic. There is no other specific code related to the date control. The following is the code fired by the Date control.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Data_AfterUpdate()
  2. Dim CstId As Single
  3. Dim SumPag1 As Single
  4. Dim SumPag2 As Single
  5. Dim SumPag3 As Single
  6. Dim Num As Byte
  7. CstId = Forms!Dipendenti!IDTblClienti
  8. Num = DLookup("PerPagam", "TblClienti", "IDTblClienti=" & CstId)
  9. Me![PerPag].Value = Num
  10. SumPag1 = Nz(DSum("VarDipendenti", "TblDipendenti", "Ditta=" & CstId), 0)
  11. SumPag2 = Nz(DSum("PrPagaMens", "TblDipendenti", "Ditta=" & CstId), 0)
  12. SumPag3 = SumPag1 * SumPag2
  13. mySQL = "UPDATE TblClienti"
  14. mySQL = mySQL & " SET TblClienti.ParcPerPghPrec =" & SumPag3 * Num
  15. mySQL = mySQL & " WHERE [IDTblClienti]=" & CstId
  16. DoCmd.SetWarnings False
  17. DoCmd.RunSQL mySQL
  18. DoCmd.SetWarnings True
  19. End Sub
  20.  
Jun 29 '16 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dave Hammond | last post by:
I have an html element (a link) with an onclick handler which opens a popup window, and would like to position that window at the coordinates where the element appears on the page. I have...
25
by: JeffS | last post by:
Honest, I scoured the comp.lang.c.faq for this but found nothing. :) Is there a library function for placing the cursor position in the console? Or is it something that can only be done with a...
7
by: Steve | last post by:
does any one know a way to determine the position of the cursor in a text box. I would like to position a list next to the current position for context commands. I am using...
1
by: Tantra Veda | last post by:
Hello C# gurus, I have a question about finding cursor position in NumericUpDown control. On my form I have a numericUpDown control with 2 decimal places. I want to increment value in the numeric...
1
by: Paul | last post by:
Hi all, I am making a DirectInput application wich must report correctly the cursor position in windowed mode (it means it has to be the same as Microsoft Window´s cursor position). First of...
3
by: Al-Burak | last post by:
I hope everybody is having a fantastic X-Mas, I will hate you for that since I have to be at the computer trying to keep my current job, grrr. :) OK, folks, jokes aside I have a question that...
2
by: tony | last post by:
Hello! Assume I catch a double click in a form by using the event handler that forms designer create for me. Now to my question when I double click in the form the event handler is trigged...
1
by: Mario Figueiredo | last post by:
Hello everyone, I'm having trouble controlling the cursor position when I make two consecutive calls to the get family of functions. This problem does not happen if there is an output in...
4
by: Brandon McCombs | last post by:
Does anyone know of an easy way to set the position of the cursor in a TextBox? If I set text in the box that is longer than the length of the TextBox the position of the cursor is at the very end...
0
by: nagarjunt | last post by:
Hi, This is nag. I have a problem with infragistics7.1 UltraTextEditor control. I am using C# code in windows form. I have UltraTextEditor control(With multi line enabled) in my Windows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.