N
Noozer
This is the last item I need to finish up an MS Access project I'm working
on...
I have a form. On this form is a listbox populated with a number of items.
There is also an ADD button. There is also a subform displaying the results
of a query.
When I click the ADD button, I want to take a piece of data from my form, a
piece of data from my list and add them to a table, then requery the
subform. I don't have anything bound directly to the table that I wish to
add to.
With the code below, assume that the data has already been gathered from the
form and listbox. How can I add this data to the table?
'Following code doesn't work (obviously) but gives idea of what I'm
trying to do
Private Sub cmdAdd_Click()
'Add a new record to the AreaCrewLink table
With Tables![CrewAreaLink]
.AddNew
!CrewKeyLink = 999
!AreaKeylink = 999
!Note = "Test Note"
.Update
End With
'Requery subform to show added record.
sub_ChooseCrewsEdit.Requery
End Sub
.... I've seen examples of how to use DAO with VB, but since this is VBA
withing an Access database I was wondering if there was a simpler, more
direct method.
Thx!
on...
I have a form. On this form is a listbox populated with a number of items.
There is also an ADD button. There is also a subform displaying the results
of a query.
When I click the ADD button, I want to take a piece of data from my form, a
piece of data from my list and add them to a table, then requery the
subform. I don't have anything bound directly to the table that I wish to
add to.
With the code below, assume that the data has already been gathered from the
form and listbox. How can I add this data to the table?
'Following code doesn't work (obviously) but gives idea of what I'm
trying to do
Private Sub cmdAdd_Click()
'Add a new record to the AreaCrewLink table
With Tables![CrewAreaLink]
.AddNew
!CrewKeyLink = 999
!AreaKeylink = 999
!Note = "Test Note"
.Update
End With
'Requery subform to show added record.
sub_ChooseCrewsEdit.Requery
End Sub
.... I've seen examples of how to use DAO with VB, but since this is VBA
withing an Access database I was wondering if there was a simpler, more
direct method.
Thx!