473,569 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making record current

MLH
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
Nov 1 '07 #1
6 2921
MLH <CR**@NorthStat e.netwrote in
news:pv******** *************** *********@4ax.c om:
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
You should learn to read the Help files. That'll tell you that the
..bookmark is the one.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Nov 1 '07 #2
"MLH" <CR**@NorthStat e.netwrote in message
news:pv******** *************** *********@4ax.c om...
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
Its the bookmark method. The update method updates the database with all
changes made since the AddNew method was called. LastModified means "the
record most recently updated", and setting the recordset's bookmark to that
value causes that record to be the "current" record.

Nov 1 '07 #3
On Nov 1, 4:25 pm, MLH <C...@NorthStat e.netwrote:
Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
The bookmark moves the record pointer to the newly created record.

Nov 1 '07 #4
MLH
I'll try the learning to read suggestion first - then I'll tackle the
HELP files. Thx for the reply.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxx
On 01 Nov 2007 21:15:56 GMT, Bob Quintal <rq******@sPAmp atico.ca>
wrote:
>MLH <CR**@NorthStat e.netwrote in
news:pv******* *************** **********@4ax. com:
>Cut this little FN out-a-Access 97 HELP. It makes mention
of the new record being made the current record. Is it the
Update method responsible for that - or the Bookmark method?
Which one?

Function AddName(rstTemp As Recordset, _
strFirst As String, strLast As String)

' Adds a new record to a Recordset using the data passed
' by the calling procedure. The new record is then made
' the current record.
With rstTemp
.AddNew
!FirstName = strFirst
!LastName = strLast
.Update
.Bookmark = .LastModified
End With

End Function
You should learn to read the Help files. That'll tell you that the
.bookmark is the one.

--
Bob Quintal

PA is y I've altered my email address.
Nov 2 '07 #5
There is a bit of a quirk with DAO if you add a new record and then update
it, right after you execute the update you lose your record position. To
make this is about the worst flaw in DAO.

Just about everything else about the dao object model is quite fine to me.

So in summary if you find a record, and then update the record the record
pointer remains in place and stays as the current record.

However if you add a *NEW* record then right after the update you lose your
record position, And must use the bookmark to reposition The record point
back to the record we just updated.

I repeat, this only occurs when you've added a new record. For existing
records it's not a problem.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
Nov 4 '07 #6
MLH
Interesting point. I must agree, I see no logic
in losing your place after Updating an AddNew.
Would-a-been better to have held the placemark
as a default behavior.
Nov 4 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7083
by: mark | last post by:
Access2000 How do I write a query that combines the CTC field from each record below into one record? I need to concatenate the CTC field with a separator, like below: BattID VehicleID STDATE STTIME CTC LKO500HF 00000000 10/27/2003 4:13:51 AM 4 LKO500HF 00000000 10/27/2003 5:13:51 AM 5 LKO500HF 00000000 10/27/2003 10:13:51 AM 6...
1
8814
by: Tony | last post by:
I have a form in access that has 5 fields for a certain record: 1)Date mailed, 2)Date received, 3)Date completed 4)Foreign Content amount and 5)record number. If the foreign content (FC)is >15% of the invoice amount (inv amt.on another form) then I want a my report to run automatically for the record I am on in the current EC Input form when...
2
5301
by: Tony | last post by:
Hello, I am having difficulty in getting the current record of the current form to show after pressing a command button that takes me to another form. The command button takes me to another form that I want to show the record of the previous form I left. The problem is that the form does not show any other record but the current one...
8
12072
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
1
2784
by: jodyblau | last post by:
I have a form that is in Continuous form. In each record there is a button next to the a date box. When the button is pushed, the calendar control is set to visible (rather than in a seperate pop up form). The problem is that makes the calendar visible for every record, not just the current record. Does anyone know of a way to set the...
1
9020
by: 2D Rick | last post by:
Access2003 in XP If I open a form to a specific record and click on a command button with the following code I get a duplcate record: DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdSaveRecord DoCmd.RunCommand acCmdCopy DoCmd.RunCommand acCmdPasteAppend OR DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
19
2772
by: Genalube | last post by:
I have an application that will produce a Word document based on five separate queries this has required that I create a ADODB connection: 'Create connection to current database Dim Conn As ADODB.Connection Set Conn = CurrentProject.Connection There are five separate recordSets, one for each query. The record sets each fill out a...
1
4329
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same logic for a date field. i.e. theValue.defaultvalue = "#" & theValue.value & "#" I can't get this to work for some reason and I can't figure out...
1
1499
by: Ste | last post by:
Hi, I would like to have current date automatically enter into a form that is based on a table, so that from report I can tell how many records I have entered for the day. If I use date() on the data entry form, would I get the record changing the date whenever I happen to browse the data entry form? That I don't want to happen. ...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5509
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.