473,663 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display created record on open form

In Access97 on a bound form, client wants a button that will duplicate
the currently displayed record and give it a new meeting nbr. I have
done it except for being able to display the new record after creating
it.
Want I've done is;

- Get the last meeting nbr from tblMtgNbrs and incurment it

- Write it to tblMtgNbrs

- Write it to tblMeetings

- set NextNbr = to meeting nbr just created

- update all the fields in tblMeetings as follows
strSQL = "Select * From tblMeetings where MeetingNbr='" & NextNbr & "'"
Set MyRec = MyDB.OpenRecord set(strSQL, dbOpenDynaset)
MyRec.Edit
MyRec!DteOfRequ est = strDte
MyRec!MeetingCo ntact = Me.bxMeetingCon tact
MyRec!MeetingPl anner = Me.bxMeetingPla nner
etc........
MyRec.Update
MyRec.Close

The issue is now I need to change the displayed record to the newly
created record which I can't seem to get accomplished.
I tried
Me.Refresh - no luck
Me.Requery - no luck

how do I get the newly created record to be the displayed record?
thanks
bobh.

Mar 23 '06 #1
2 1560
Hello.

Perhaps you can enter the following code:

DoCmd.GoToRecor d , , acLast

Good luck.

Regards

Mar 23 '06 #2
bobh wrote:
In Access97 on a bound form, client wants a button that will duplicate
the currently displayed record and give it a new meeting nbr. I have
done it except for being able to display the new record after creating
it.
Want I've done is;

- Get the last meeting nbr from tblMtgNbrs and incurment it

- Write it to tblMtgNbrs

- Write it to tblMeetings

- set NextNbr = to meeting nbr just created

- update all the fields in tblMeetings as follows
strSQL = "Select * From tblMeetings where MeetingNbr='" & NextNbr & "'"
Set MyRec = MyDB.OpenRecord set(strSQL, dbOpenDynaset)
MyRec.Edit
MyRec!DteOfRequ est = strDte
MyRec!MeetingCo ntact = Me.bxMeetingCon tact
MyRec!MeetingPl anner = Me.bxMeetingPla nner
etc........
MyRec.Update
MyRec.Close

The issue is now I need to change the displayed record to the newly
created record which I can't seem to get accomplished.
I tried
Me.Refresh - no luck
Me.Requery - no luck

how do I get the newly created record to be the displayed record?
thanks
bobh.

If you were to add the record to the recordset...
Set rst = Me.Recordsetclo ne
and then add the record you could do something like
rst.AddNew
rst.Update
rst.bookmark = rst.lastmodifie d
Me.bookmark = rst.Bookmark

It appears you are adding not from the form's recordset. But since you
have the ID, you could do something like
Me.Requery
Set rst = Me.Recordsetclo ne
rst.FindFirst "ID = " & NextNumber
Me.BookMark = rst.Bookmark

You might want to read about these properties in help for additional
information.
Mar 23 '06 #3

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

Similar topics

3
2907
by: DataBard007 | last post by:
My Access 97 database has a form that contains text boxes that display people's names, addresses, phone numbers, etc. The record source is a single table. I created a NextRecord and Previous Record command button that, when clicked, will display the next record and the previous record, respectively. But what if I want a quick glance at all my records? Is there a way to get the records to display automatically, one after another, with a...
17
2065
by: perryche | last post by:
I have 5records, e.g. Rc1, Rc2, Rc3..., when user open up a form, I want it to open to a particular record (say Rc3) then when user chooses the Record Selector , it will go to Rc2 and , it will go to Rc4. If I use Sort in the query, it is sorted alphabetically; if I do not sort, whatever is the latest record will be on top. Any help/insight will be appreciated. Perry
12
20904
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database contains the paths to the pictures. The database consists of two tables: TABLE DATA ID Name LastName
0
5811
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database which indexes computer magazine articles for personal reference. I am developing a Visual Basic.NET program whose sole purpose is to enter new records into the database. No updates to existing entries, no deletions, and no display
2
5201
by: emc_cos | last post by:
I have a very nice parent child relationship happening between a main form and 8 subforms. The main form is the data entry point for a table that holds textual data like names, notes and the like. It also holds the primary key which is an alpha-numeric file designation. The subforms are the data entry point for another table that holds numeric values for time spent on tasks.
2
3201
by: kev | last post by:
Hi Folks, I have created a search query in which it successfully returns correct results. When there are no records returned, instead of giving out a blank form i created a pop-up msg which is attached to the On Open event. However, right after the msg box pops saying"no records", this is followed by another msg box with "TheOpen Form action was cancelled". Is there a way i can eliminate the second msg box from appearing?
3
3926
by: ApexData | last post by:
I am using a continuous form for display purposes. Above this form, a single record is displayed so that when the user presses my NewButton they can enter a NewRecord which gets added to the continuous form that displays below. Under the NewButton I have these lines of code: Me.AllowAdditions = True DoCmd.GoToRecord , , acNewRec
1
3768
by: Coll | last post by:
Hi - I'm trying to figure out how to append a record to a table and then open a form and display that record. My thought was to use the autonum primary key field (recordnum) and display the highest value (which would be the new record), but I'm not sure if that can be done. Any thought on displaying the record with the highest value in the recordnum field or another approach would be appreciated. Thanks!
2
16651
by: smorrison64 | last post by:
I have a form that is coded to open a File Dialog boc to pick a picture to display on that particular item on a subform. My form is not based on query, but rather two separate tables (one primary, one sub). That code is working properly. How do I get that to translate to my report? I use VBA code because I use formats other than BMP for the pictures. Would basing the form on the qury that the report is based on solve the issue without...
0
8436
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8858
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8771
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8548
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5657
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
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

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.