Hi, I have been successful copying a vba code from one of your posts on
how to copy and paste a record by declaring the desired fields that
needs to be copied in form's declaration and creating two button "copy"
and "paste". Works like magic.
My problem is how can I copy multiple records and paste them at the
same time. My data entry form has main form that has a Questionlist box
of Questions. The second list box on the same form displays
subquestions based on the selection made in Question list box. The
subform allows to add response for a selected subquestion. Majority of
the time response choices are the same for all the subquestion.
Based on the scenario below, if I do data entry for SubquestionA, I
want to copy/paste all three records to Subquestion B and Subquestion
C.
Question A has
Sub questions A, B, C.
SubQuestion A: Response Choice: 1, 2, 3
SubQuestion B: Response Choice: 1, 2, 3
SubQuestion C: Response Choice: 1, 2, 3
Please let me know how can I achieve that. It will save a lot of time
entering the same records.
Thanks for all your help.
Manjeet 5 13957
Kaur wrote: Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two button "copy" and "paste". Works like magic. My problem is how can I copy multiple records and paste them at the same time. My data entry form has main form that has a Questionlist box of Questions. The second list box on the same form displays subquestions based on the selection made in Question list box. The subform allows to add response for a selected subquestion. Majority of the time response choices are the same for all the subquestion. Based on the scenario below, if I do data entry for SubquestionA, I want to copy/paste all three records to Subquestion B and Subquestion C. Question A has Sub questions A, B, C. SubQuestion A: Response Choice: 1, 2, 3 SubQuestion B: Response Choice: 1, 2, 3 SubQuestion C: Response Choice: 1, 2, 3
Please let me know how can I achieve that. It will save a lot of time entering the same records. Thanks for all your help.
Manjeet
I don't know what your solution is for one record but I should think
that the help file/code examples on ItemsSelected, Selected, ItemCount,
ListIndex...etc will get you what you need to loop through a list.
Thanks for replying.
This is the code I have used.
Option Compare Database
Dim Respondent As String
Dim ResponseNotes As String
Private Sub cmdCopy_Click()
Respondent = Me.RespondentID
ResponseNotes = Me.RespondentGroupNotes
End Sub
Private Sub cmdPaste_Click()
Me.RespondentID = Respondent
Me.RespondentGroupNotes = ResponseNotes
This allows me to copy just the one record in the datasheet subform for
a given subquestion and paste to next subquestion.
I am new to Access so seekin help to resolve this problem.
Thanks
salad wrote: Kaur wrote:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two button "copy" and "paste". Works like magic. My problem is how can I copy multiple records and paste them at the same time. My data entry form has main form that has a Questionlist box of Questions. The second list box on the same form displays subquestions based on the selection made in Question list box. The subform allows to add response for a selected subquestion. Majority of the time response choices are the same for all the subquestion. Based on the scenario below, if I do data entry for SubquestionA, I want to copy/paste all three records to Subquestion B and Subquestion C. Question A has Sub questions A, B, C. SubQuestion A: Response Choice: 1, 2, 3 SubQuestion B: Response Choice: 1, 2, 3 SubQuestion C: Response Choice: 1, 2, 3
Please let me know how can I achieve that. It will save a lot of time entering the same records. Thanks for all your help.
Manjeet I don't know what your solution is for one record but I should think that the help file/code examples on ItemsSelected, Selected, ItemCount, ListIndex...etc will get you what you need to loop through a list.
Kaur wrote: Thanks for replying. This is the code I have used.
Option Compare Database Dim Respondent As String Dim ResponseNotes As String
Private Sub cmdCopy_Click() Respondent = Me.RespondentID ResponseNotes = Me.RespondentGroupNotes End Sub
Private Sub cmdPaste_Click() Me.RespondentID = Respondent Me.RespondentGroupNotes = ResponseNotes
This allows me to copy just the one record in the datasheet subform for a given subquestion and paste to next subquestion.
I am new to Access so seekin help to resolve this problem.
'this enumerates through the listbox. 1st col = 0.
'last col = num of columns-1
Dim var As Variant
Dim rst As DAO.Recordset
set rst = currentdb.openrecordset("TableName",dbopendynaset_
For Each var In Me.ListBoxName.ItemsSelected
rst.AddNew
rst!ID = ListBoxName.Column(0,var)
rst!RespondentGroupNotes = ListBoxName.Column(1,var)
rst.Update
Next
rst.close
set rst = Nothing
This is an example. You should be able to get the gist of it and modify
to suit. Thanks salad wrote:
Kaur wrote:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two button "copy" and "paste". Works like magic. My problem is how can I copy multiple records and paste them at the same time. My data entry form has main form that has a Questionlist box of Questions. The second list box on the same form displays subquestions based on the selection made in Question list box. The subform allows to add response for a selected subquestion. Majority of the time response choices are the same for all the subquestion. Based on the scenario below, if I do data entry for SubquestionA, I want to copy/paste all three records to Subquestion B and Subquestion C. Question A has Sub questions A, B, C. SubQuestion A: Response Choice: 1, 2, 3 SubQuestion B: Response Choice: 1, 2, 3 SubQuestion C: Response Choice: 1, 2, 3
Please let me know how can I achieve that. It will save a lot of time entering the same records. Thanks for all your help.
Manjeet
I don't know what your solution is for one record but I should think that the help file/code examples on ItemsSelected, Selected, ItemCount, ListIndex...etc will get you what you need to loop through a list.
Thanks for the code. It seems like it takes the records and appends to
the same ID. This is the code I have.
Private Sub cmdPaste_Click()
Dim var As Variant
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblRespondent",
dbOpenDynaset)
_
For Each var In Me.LstResp.ItemsSelected
rst.AddNew
rst!RespondentID = LstResp.Column(0, var)
rst!RespondentGroupNotes = LstResp.Column(2, var)
rst!SurveyID = LstResp.Column(3, var)
rst!SurveyEditionID = LstResp.Column(4, var)
rst!QuestionID = LstResp.Column(5, var)
rst!SubQuestionID = LstResp.Column(6, var)
rst.Update
Next
rst.Close
Set rst = Nothing
End Sub
It looks like I am close to the answer to my problem but not there yet.
How do I copy first from first subquestion that has the data populated
with above fields and then go to the next subquestion and append the
records. Right now it will allow me to append these records to the same
subquestion.
Thanks for your time.
salad wrote: Kaur wrote:
Thanks for replying. This is the code I have used.
Option Compare Database Dim Respondent As String Dim ResponseNotes As String
Private Sub cmdCopy_Click() Respondent = Me.RespondentID ResponseNotes = Me.RespondentGroupNotes End Sub
Private Sub cmdPaste_Click() Me.RespondentID = Respondent Me.RespondentGroupNotes = ResponseNotes
This allows me to copy just the one record in the datasheet subform for a given subquestion and paste to next subquestion.
I am new to Access so seekin help to resolve this problem. 'this enumerates through the listbox. 1st col = 0. 'last col = num of columns-1
Dim var As Variant Dim rst As DAO.Recordset set rst = currentdb.openrecordset("TableName",dbopendynaset_ For Each var In Me.ListBoxName.ItemsSelected rst.AddNew rst!ID = ListBoxName.Column(0,var) rst!RespondentGroupNotes = ListBoxName.Column(1,var) rst.Update Next rst.close set rst = Nothing
This is an example. You should be able to get the gist of it and modify to suit.
Thanks salad wrote:
Kaur wrote:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two button "copy" and "paste". Works like magic. My problem is how can I copy multiple records and paste them at the same time. My data entry form has main form that has a Questionlist box of Questions. The second list box on the same form displays subquestions based on the selection made in Question list box. The subform allows to add response for a selected subquestion. Majority of the time response choices are the same for all the subquestion. Based on the scenario below, if I do data entry for SubquestionA, I want to copy/paste all three records to Subquestion B and Subquestion C. Question A has Sub questions A, B, C. SubQuestion A: Response Choice: 1, 2, 3 SubQuestion B: Response Choice: 1, 2, 3 SubQuestion C: Response Choice: 1, 2, 3
Please let me know how can I achieve that. It will save a lot of time entering the same records. Thanks for all your help.
Manjeet
I don't know what your solution is for one record but I should think that the help file/code examples on ItemsSelected, Selected, ItemCount, ListIndex...etc will get you what you need to loop through a list.
Kaur wrote: Thanks for the code. It seems like it takes the records and appends to the same ID. This is the code I have.
Private Sub cmdPaste_Click()
Dim var As Variant Dim rst As DAO.Recordset Set rst = CurrentDb.OpenRecordset("tblRespondent", dbOpenDynaset) _ For Each var In Me.LstResp.ItemsSelected rst.AddNew rst!RespondentID = LstResp.Column(0, var) rst!RespondentGroupNotes = LstResp.Column(2, var) rst!SurveyID = LstResp.Column(3, var) rst!SurveyEditionID = LstResp.Column(4, var) rst!QuestionID = LstResp.Column(5, var) rst!SubQuestionID = LstResp.Column(6, var) rst.Update Next rst.Close Set rst = Nothing End Sub
It looks like I am close to the answer to my problem but not there yet. How do I copy first from first subquestion that has the data populated with above fields and then go to the next subquestion and append the records. Right now it will allow me to append these records to the same subquestion. Thanks for your time.
I am unsure how to answer your problem/question. It's difficult for me
to visualize your form and what exactly it is you need to do.
You have a form. It has 2 list boxes; a Questionlist box of Questions
and then a listbox of subquestions. Then you have a subform that gets
updated...I think. I am unsure what the flow is...what you are
selecting to be updated and what should be updated. Where is the data
coming from? I think/know I would need more info/clarification in order
to help. salad wrote:
Kaur wrote:
Thanks for replying. This is the code I have used.
Option Compare Database Dim Respondent As String Dim ResponseNotes As String
Private Sub cmdCopy_Click() Respondent = Me.RespondentID ResponseNotes = Me.RespondentGroupNotes End Sub
Private Sub cmdPaste_Click() Me.RespondentID = Respondent Me.RespondentGroupNotes = ResponseNotes
This allows me to copy just the one record in the datasheet subform for a given subquestion and paste to next subquestion.
I am new to Access so seekin help to resolve this problem.
'this enumerates through the listbox. 1st col = 0. 'last col = num of columns-1
Dim var As Variant Dim rst As DAO.Recordset set rst = currentdb.openrecordset("TableName",dbopendynaset_ For Each var In Me.ListBoxName.ItemsSelected rst.AddNew rst!ID = ListBoxName.Column(0,var) rst!RespondentGroupNotes = ListBoxName.Column(1,var) rst.Update Next rst.close set rst = Nothing
This is an example. You should be able to get the gist of it and modify to suit.
Thanks salad wrote:
Kaur wrote: >Hi, I have been successful copying a vba code from one of your posts on >how to copy and paste a record by declaring the desired fields that >needs to be copied in form's declaration and creating two button "copy" >and "paste". Works like magic. >My problem is how can I copy multiple records and paste them at the >same time. My data entry form has main form that has a Questionlist box >of Questions. The second list box on the same form displays >subquestions based on the selection made in Question list box. The >subform allows to add response for a selected subquestion. Majority of >the time response choices are the same for all the subquestion. >Based on the scenario below, if I do data entry for SubquestionA, I >want to copy/paste all three records to Subquestion B and Subquestion >C. >Question A has >Sub questions A, B, C. >SubQuestion A: Response Choice: 1, 2, 3 >SubQuestion B: Response Choice: 1, 2, 3 >SubQuestion C: Response Choice: 1, 2, 3 > >Please let me know how can I achieve that. It will save a lot of time >entering the same records. >Thanks for all your help. > >Manjeet >
I don't know what your solution is for one record but I should think that the help file/code examples on ItemsSelected, Selected, ItemCount, ListIndex...etc will get you what you need to loop through a list.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Londeck |
last post by:
I am using Visual Basic 2003 and I have written a notepad like application
using the RichTextBox control. I am having trouble trying to emulate
Microsoft Words text block copy/paste feature. In MS Word you would Hold
Alt
while clicking and dragging the mouse. A block of text would then be
selected
and you can then copy and paste what you...
|
by: andree |
last post by:
Hello,
I have a form where a user may paste multiple records. The form has an
AfterInsert procedure. The procedure copies the newly inserted record
into a different table for audit purposes.
When one record is pasted, all is working fine. If multiple records
are pasted, the AfterInsert event gets fired before the Paste
Confirmation...
|
by: Sean Howard |
last post by:
Dear All,
As is my want I need to do something in Access that seems simple but
cannot fathom out.
I have main form with two subforms, both datasheets with an almost
identical table structure.
I want to add the functionality to copy records from subformA to
subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
|
by: HB2 |
last post by:
I use to be able to highlight several records in a table, copy them
and paste new records. Now when I right click the records the copy
and paste functions are disabled. How do I enable them?
Thanks
|
by: PalJoey |
last post by:
I am having a problem copying and pasting records into the same table.
When I copy a record that has a zero length string for a field Access
seems to convert it to NULL when pasted. One of the fields does not
allow NULLS so I cannot paste the record. I get the error "You tried
to assign the null value to a variable that is not a variant data...
| |
by: igendreau |
last post by:
I have a database with a Header table. Each record in tblHeader has
two One-to-Many Relationships: with tblLines and tblKeys. The HeaderID
field ties tblHeader to the other two tables. The data collected in
tblHeader is simple: HeaderID (unique), a text description field, and a
date field.
I need to be able to copy header and it's...
|
by: 4Him |
last post by:
First off, let me say this is a great site! I've just started working with Access and much of my success is from what I've read here!
Background: I have a form, driven off a single table.
Goal: To have multiple fields copied and pasted into multiple records with a single button click.
Work Done: In the form I have multiple fields, but for...
|
by: kcdoell |
last post by:
Good morning everyone:
I created a form and set the default view as a continuous form. Basically the form is displaying records in which the user can add or edit new ones. The record source for this form is a query that I built that is based on a table.
I have been working on this for several weeks and now I have been told that many...
|
by: phill86 |
last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in the main form. I have two buttons in the sub form one for selecting and copying all the records and another for pasting the records this enables me to...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |