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 13772
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...
|
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.
...
|
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....
|
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?
...
|
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...
|
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...
|
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:...
|
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...
|
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...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
| |