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

Home Posts Topics Members FAQ

How to retrieve selected record from subform datasheet and insert into a table?

Is it possible for a user to select a record from a datasheet in a subform, double click it, and write that specific record to another table? I have attempted to perform this task using DoCmd.DoMenuIte m commands and RunCommand acCmds but with no luck? Im currently building this system in VBA with MS Access 2003. Thus far I have only been able to copy the selected record to a the windows clipboard to be used in other text-based platforms, but I need to write this information to a temporary table for data-manipulation. The subform is running a query to filter information based on a combobox.

Any help will be greatly appreciated.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_DblClick(Cancel As Integer)
  2. If MsgBox("Are you sure you want to activate this part?", vbYesNo) = vbYes Then
  3.     RunCommand acCmdSelectRecord
  4.     RunCommand acCmdCopy 'This copies the information to the clipboard.
  5.  
  6.     'These are methods I attempted to use - but ultimately do the same thing.
  7.  
  8. '    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
  9. '    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
  10. '    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
  11.  
  12.     Else
  13.     Exit Sub
  14. End If
  15. End Sub
  16.  
Nov 19 '10 #1
2 3262
RuralGuy
375 Recognized Expert Contributor
Here's a link that will help to bring those DoMenuItem commands up to the RunCommand level. Much easier to understand if nothing else. http://www.accessruncommand.com/domenuitem.htm
Nov 22 '10 #2
Thanks for the link - helped me understand more about how the menuItems work. Unfortunately my problem still stands and it seems as though none of the items available (under RunCommand or DoMenuItem) can perform the necessary function I require.
Nov 22 '10 #3

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

Similar topics

1
12043
by: edself | last post by:
I have a form which displays a subform datasheet of information. I'd like to be able to quickly click on a particular record and open up another form showing more detailed information about that record from a related table. Is there a way to do this? It would be nice to be able to right click on a cell in a datasheet and then select menu choice to open a form with related information, but it seems like to right click menues in Access...
5
24025
by: deko | last post by:
I have a subform datasheet that contains a full year of records sorted by a date field. I'm trying to programmatically move the record selector on the datasheet to the first record that matches a particular date. For example, the user clicks a button and the record selector moves to the first record that matches today's date. I was thinking something like this, but I'm not having any luck: Dim rst As DAO.Recordset Set rst =...
3
9105
by: deko | last post by:
I have a form with a subform datasheet - I need code behind the OnDelete event of the subform: Private Sub Form_Delete(Cancel As Integer) 'do something that depends on which record is deleted End Sub This works okay when only one record is selected and the delete key is pressed (or right-click delete is selected - makes no difference). But if multiple records are selected in the datasheet, the code runs for the first
7
11182
by: ChrisR | last post by:
Hi guys My app is a simple Main form with a few Subforms that are not linked, and a few pop forms. Problem is: I have a pop form with a Listbox with a list of records related to the subform in the Main form. I'd like to double click on the selected file in the listbox and load that record into the the Subform, easy
1
2731
by: sofakingfree | last post by:
Is there a way to perform actions on the selected records of a datasheet subform? Actually I know it can be done from a pulldown menu or a toolbar. But how can you create a button on the form that will do the same thing? My problem is that every time you select something on the datasheet when you click a button or any control you will lose the selection. Is there anyway to prevent that? I'd rather create a button than try to manage...
1
2154
by: sherbert1967 | last post by:
How do I determine (from main form) what rows have been selected within a (datasheet style) subform. As I need to transfer these rows to another table. Can this be achieved via code? Please assist!!!
11
3139
by: cooperkuo | last post by:
Dear all, I have a question about ADO in the subform. I know how to use ADO to insert/update/select data into the sigin form, but wehn I try to do it in the form with subform((Datasheet). I don't have any idea how to insert/update/select the recordset data into the subform(Datasheet), especially insert/update. Would someone can give me a idea or sample code to me? Appreciate your help. OS: windows XP +SP2+ Access 2003+SP2 Database: MS...
1
1397
by: natural | last post by:
Good Morning I have an unbound form "FrmInterviewSuccesfful" with some unbound fields on it There is also an option box with 3 options and by clicking on it my subform wil filter with Sucessfull/Unsucessful and all Candiates Works Perfectly.. In my subform i have the id some extra info about the candidate and then a tick box calles MoveToOffer.
1
3273
by: menkenk | last post by:
Good Afternoon, I currently have an issue in trying to get a macro working for clicking a record in a subform datasheet to open a form with the complete record details of that specific record. What I used is as follows : =!! is the subform and is the main form. is the form I would like to open which contains all the fields for the complete record details. I attached the macro to the on click event of . It keeps asking me for a...
0
2029
by: clarkp73 | last post by:
Hi In VBA I populate an unbound subform (datasheet view) via a recordset that can be changed using filters selected by the user. The only problem I am having is that due to the unbound nature of the subform the sorting function activated by the column header click only works once, the second time the user tries a sort an error occurs ("Data provider could not be initialized"). Is there any way I could handle the column header click in code...
0
8827
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
8732
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
8503
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
8605
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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();...
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.