473,406 Members | 2,343 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,406 software developers and data experts.

Bookmark and refresh form

171 100+
Hi All

I have two issues to put forward.
First is bookmarking / or highlighting a particular record in a form. The form is continuous and the records are from a query result. One of the record in that form will be always the last added record from the table. The form display the records in a sort order from the query. What i need is to highlight or bookmark a particular field of that record (the last record added) whatever the position of the record in the form to get the user's attention to this record.
Second issue is in the same form when it opens with the records i want to perform a calculation automatically and update one of the field with the new result and save the updated record.
I already mention that the form displayes query result.
There are two date fields/controls and three time fields/controls.
The calculation need to be based on the dates and two time fields and the time need to be updated as per the calculation perofrmed.
The calculation can be done after the form loaded and can place command button to perform this action.
Please guide me how to achieve this.

Thank you all
Jul 17 '09 #1
11 6438
ChipR
1,287 Expert 1GB
To highlight a particular record, you can add a field to your table/query and mark that record as true and the rest false. Then, do conditional formatting based on that field.
For your second issue, is there any reason you can't run an update query?
Jul 20 '09 #2
rajeevs
171 100+
Hi ChipR
Sorry for the late reply. I think my explanation about the issue is not clear. I would like to explain because with your answer i am nowhere reaching for the result. What i am doing is adding records to a table through a form and on click of a button from that form it opens another form which is a result of a query and that form contains few other records and the last added record. But the records are in a sort order already by a time field from the query. So I want to get focus on the record which is added last in the table. Now the focus is always on the first record of the form. I been searching net about the bookmark and recordclone things but i am not sure what would solve the issue.
Please help
Thank you
Jul 27 '09 #3
ChipR
1,287 Expert 1GB
I see what you mean. You don't want to highlight the record, you just want to select it. Is the time field in the query the time the record was created, or some other unrelated time? Is the record you want to move to the last record of the recordset, or do you need to find it based on some other criteria?
Jul 27 '09 #4
rajeevs
171 100+
Hi
Thank you for prompt reply.
My table has few time fields related to each record. My Main form is used to enter new data to the table and the time field is an entry by the user.. That is an unbound form. Once the user finish the entry of a new record he click a button which add the record to the table and it opens another form. The second form record source is a query. This form display the records as per the criteria in query. The second form always contain the currently added record also. This record will be placed according to the sorted time filed. But I want either the cursor focus on this particular record or highlight any filed of that record wherever the position of that record in the second form when the second form opens. Waiting for your reply
Thank you
Jul 27 '09 #5
ChipR
1,287 Expert 1GB
What is the primary key by which you can find the new record in the form that is opened?
Jul 27 '09 #6
rajeevs
171 100+
Hi
So fast. Thank you
There is no primary key, but the main form is still kept open and one field is unique say field name as NAME and the NAME field value is still available in the main form. The second form also has the same field.
So while opening the second form it can be used as a reference
Jul 27 '09 #7
ChipR
1,287 Expert 1GB
I'll have some code you can use in a second. Would the NAME field be text or number?
Jul 27 '09 #8
rajeevs
171 100+
Hi
It is a text field.
Jul 27 '09 #9
ChipR
1,287 Expert 1GB
Ok, I would suggest using the OpenArgs argument to the DoCmd.OpenForm to pass the NAME to the new form.
Expand|Select|Wrap|Line Numbers
  1. 'OpenArgs is the 7th argument to DoCmd
  2. DoCmd.OpenForm "Other Form Name", , , , , , Name
  3.  
  4. 'In the newly opened form
  5. Private Sub Form_Open(Cancel As Integer)
  6. On Error GoTo ErrorHandler
  7.  
  8.   Dim rs As Object
  9.  
  10.   If Not IsNull(OpenArgs)
  11.     Set rs = Me.RecordsetClone
  12.     rs.FindFirst "NAME = """ & OpenArgs & """"
  13.     If Not rs.nomatch Then
  14.       Me.Bookmark = rs.Bookmark
  15.     End If
  16.   End If
  17.  
  18. ExitCode:
  19.    Exit Sub
  20.  
  21. ErrorHandler:
  22.    MsgBox "Error Number: " & Err.Number & vbcrlf & "Description: " & Err.Description
  23.  
  24. End Sub
Jul 27 '09 #10
rajeevs
171 100+
Hi ChipR
Excellent !!!
This is what i was really looking for. Thank you so much.
I tried your code and it does what i was looking for the last one week.
Thank you once agin.
And can i mention another issue as part of the same thread?
With the second form which is opened with records has time fields that already i mentioned. I need to find the difference of the time from this recordset.
if record1 has time filed 1030 and record2 has timefield 1036 and record3 has timefield 1048, i need to show the time difference in the footer of the form (or anywhere in the form) that diff1=0006 diff2=0012.
May be i am not clear. But with this the user can find the next time slot avialable for the new record he added and can edit that record. I can find the Dmax and do the calculation but that is not the requirement. I need a function which cylce through all the records and find the difference of time from 1st record to the last record. Hope you can understand what i mean.

Once again thank you for the patience you have shown and the help
Jul 27 '09 #11
ChipR
1,287 Expert 1GB
I'm worried that this approach will be very slow, but it's the only thing I can think of without adding another field to the table.
Expand|Select|Wrap|Line Numbers
  1.  = [TimeField] - DMax ("TimeField", "myTable", "TimeField < " & [TimeField])
If these are dates, then something like DateDiff may be required.
If this form shows records in a continuous fashion, this will have to be in a function call, or they will all be set to the last calculation.
Jul 27 '09 #12

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

Similar topics

4
by: Bookmark | last post by:
I have a form that does a few things, such as collect data and than using cdonts emails this data to a place to be parsed. I need to add a bookmark command to this form. I have a javascript...
1
by: Targa | last post by:
After I submit a form from a popup window, I use the following code to close the popup and refresh the parent window. <a href="#" onclick="window.opener.location.reload();self.close();return...
17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
2
by: Thelma Lubkin | last post by:
With Me!PERSONSLIST.Form.RecordsetClone .FindFirst strID If .NoMatch Then Debug.Print "key " & Key & " nomatch" Exit Sub Else If Me.Dirty Then Me.Dirty = False Debug.Print "A_LOAD bookmark = "...
2
by: Len Robichaud | last post by:
I wrote the code below to be called by a button on an open form (that has a subform) when we need to create a new (Ghost) record using some of the fields from the existing (current) record. The...
5
by: Kaur | last post by:
Hi, I am having a strange bookmark problem. I have a main form called frmSurveyQSubQ. This form has a subform called sfrmRespodent. SfrmRespondent has a sfrm in it called sfrsfrmResponses. I have...
4
by: zzapper | last post by:
Hi, I use an internal bookmark <form method="post" action="${form_action}#mark1"> to return to the correct place in the page. In case of an error I would wish to return to the top of the...
11
by: Tom Clavel | last post by:
I need to make sure that I am on a different record than I just was on, in a DAO recordset. code fragment: 1. strFind = "thisSource = " & tripID & " AND thisTrip = " & tripID 2. ...
13
by: eighthman11 | last post by:
using Access 2003 and sql server version 8.0 Hey everyone. Created a text box where the user types in an Inventory number and it takes them to that inventory number on the contimuous form. The...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.