yes thanks. i know how to access the columns however i dont know how to include it into my current code. the column data needs to be included as you have it for each waferid added in table "tblWaferIDToLayer".
Main Topics
Browse All Topics
'''Right here I have all items in "ListBoxWaferID" selected and I am creating a new record for every item
For Each varItm In Me.ListBoxWaferID.ItemsSel
Me.tmpWaferID.value = Me.ListBoxWaferID.ItemData
varWaferID = Me.tmpWaferID
Set rstWaferTable = db.OpenRecordset("tblWafer
With rstWaferTable
.AddNew
rstWaferTable![LotID] = varLotID
rstWaferTable![WaferID] = varWaferID
rstWaferTable.Update
rstWaferTable.Close
End With
'Right here I am putting the same "varWaferID" in a seperate table
Set rstLayerTable = db.OpenRecordset("tblWafer
With rstLayerTable
.AddNew
rstLayerTable![WaferID] = varWaferID
rstLayerTable.Update
rstLayerTable.Close
End With
'Right here I would like to append data from "listBoxLayerInfo" to the "varWaferID" created in "tblWaferIDToLayer".
'There are about 6 columns in the listbox
'[Layer], [Field], [Address Size], [Mask Grade], and [Percent Clear]
''''''
''''''
''''''
''''''
Next
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Do you need to get the ID generated from the database when you added the Record to the tblWaferIDToLayer table?
With rstLayerTable
.AddNew
rstLayerTable![WaferID] = varWaferID
IDvariable = rstLayerTable.fields("Gene
rstLayerTable.Update
rstLayerTable.Close
End With
Otherwise why can it not be added using the same method as above with varwaferID variable?
ok, think of something like this
For Each varItm In Me.ListBoxWaferID.ItemsSel
Me.tmpWaferID.value = Me.ListBoxWaferID.ItemData
varWaferID = Me.tmpWaferID
Set rstWaferTable = db.OpenRecordset("tblWafer
With rstWaferTable
.AddNew
rstWaferTable![LotID] = varLotID
rstWaferTable![WaferID] = varWaferID
rstWaferTable.Update
rstWaferTable.Close
End With
Set rstLayerTable = db.OpenRecordset("tblWafer
With rstLayerTable
.AddNew
rstLayerTable![WaferID] = varWaferID
For LayerIndex = 0 To ListBox.ListCount - 1
If ListBox.Selected(Index) = True Then
rstLayerTable![LayerNameRe
rstLayerTable![Field] = listbox.Column(2, index))
rstLayerTable![AddressSize
rstLayerTable![MaskGrade] = listbox.Column(4, index))
rstLayerTable![PercentClea
End If
Next LayerIndex
rstLayerTable.Update
rstLayerTable.Close
End With
Next
or maybe something more like this....
For Each varItm In Me.ListBoxWaferID.ItemsSel
Me.tmpWaferID.value = Me.ListBoxWaferID.ItemData
varWaferID = Me.tmpWaferID
Set rstWaferTable = db.OpenRecordset("tblWafer
With rstWaferTable
.AddNew
rstWaferTable![LotID] = varLotID
rstWaferTable![WaferID] = varWaferID
rstWaferTable.Update
rstWaferTable.Close
End With
Set rstLayerTable = db.OpenRecordset("tblWafer
With rstLayerTable
.AddNew
rstLayerTable![WaferID] = varWaferID
For Each LayerIndex In Me.ListBox.ItemSelected
rstLayerTable![LayerNameRe
rstLayerTable![Field] = listbox.Column(2, index))
rstLayerTable![AddressSize
rstLayerTable![MaskGrade] = listbox.Column(4, index))
rstLayerTable![PercentClea
Next LayerIndex
rstLayerTable.Update
rstLayerTable.Close
End With
Next
For Each varItm In Me.ListBoxWaferID.ItemsSel
Me.tmpWaferID.value = Me.ListBoxWaferID.ItemData
varWaferID = Me.tmpWaferID
Set rstWaferTable = db.OpenRecordset("tblWafer
With rstWaferTable
.AddNew
rstWaferTable![LotID] = varLotID
rstWaferTable![WaferID] = varWaferID
rstWaferTable.Update
rstWaferTable.Close
End With
Set rstLayerTable = db.OpenRecordset("tblWafer
With rstLayerTable
For LayerIndex = 0 To ListBox.ListCount - 1
If ListBox.Selected(Index) = True Then
.AddNew
rstLayerTable![WaferID] = varWaferID
rstLayerTable![LayerNameRe
rstLayerTable![Field] = listbox.Column(2, index))
rstLayerTable![AddressSize
rstLayerTable![MaskGrade] = listbox.Column(4, index))
rstLayerTable![PercentClea
rstLayerTable.Update
End If
Next LayerIndex
rstLayerTable.Close
End With
Next
it appears to be having a problem with this:
rstLayerTable![LayerNameRe
if i change it to this then it is okay. but its the reason why its adding only the first item in listbox.
rstLayerTable![LayerNameRe
possibly there is something wrong with this:
For LayerIndex = 0 To ListBox.ListCount - 1
If ListBox.Selected(Index) = True Then
nope... i found the problems.
(1)we somehow started interchanging "LayerIndex" and "Index"!
(2)we had one too many parenthesis in our column code.
so here is the final which works perfectly! thanks for all your help! you did exactly what I wanted I just made things more difficult by trying to adjust your "index" to something more understandable to myself and neglected to implement it elsewhere.
For Each varItm In Me.ListBoxWaferID.ItemsSel
Me.tmpWaferID.value = Me.ListBoxWaferID.ItemData
varWaferID = Me.tmpWaferID
Set rstWaferTable = db.OpenRecordset("tblWafer
With rstWaferTable
.AddNew
rstWaferTable![LotID] = varLotID
rstWaferTable![WaferID] = varWaferID
rstWaferTable.Update
rstWaferTable.Close
End With
Set rstLayerTable = db.OpenRecordset("tblWafer
With rstLayerTable
For Index = 0 To ListBox.ListCount - 1
If ListBox.Selected(Index) = True Then
.AddNew
rstLayerTable![WaferID] = varWaferID
rstLayerTable![LayerNameRe
rstLayerTable![Field] = ListBox.Column(2, Index)
rstLayerTable![AddressSize
rstLayerTable![MaskGrade] = ListBox.Column(4, Index)
rstLayerTable![PercentClea
rstLayerTable.Update
End If
Next Index
rstLayerTable.Close
End With
Next
i have one more question for you though...
how would i make it error proof if any one of the column values were null
rstLayerTable![WaferID] = varWaferID
rstLayerTable![LayerNameRe
rstLayerTable![Field] = ListBox.Column(2, Index)
rstLayerTable![AddressSize
rstLayerTable![MaskGrade] = ListBox.Column(4, Index) ''' <-------for instance, maybe this value is empty. currently it errors out. i would like it to continue to next
rstLayerTable![PercentClea
Business Accounts
Answer for Membership
by: rthomsenPosted on 2003-12-11 at 15:32:40ID: 9924566
I'm not sure if I understand your question but I think you are trying to figure out how to access the 6 columns in your other listbox to add it to the database.
Try using this
for index = 0 to lstbox.listcount -1
If listbox.Selected(index) = True Then
col1value = listbox.Column(0, index))
col2value = listbox.Column(1, index))
col3value = listbox.Column(2, index))
End If
next index
I hope this helps