VBA Code not working need help as soon as possible
Posted on 2006-11-07
I am working with an access database with over 200000 records. I have been breaking it down into smaller databases, mailmerging it into another document, now i would like to import the information back into the database with a field changed to "yes" as you will see from this code, does any 1 know what is wrong with this?
Private Sub cmdrun_Click()
Dim dbdatabase As Object
Dim rstVideos As Object
Dim fldEnumerator As Object
Dim fldColumns As Object
Dim sqlstr As String
Set bdatabase = CurrentD
Set rstVideos = bdatabase.OpenRecordset("tbltest")
Set fldColumns = rstVideos.Fields
sqlstr = "select * from GLEN2"
.RowSource = sqlstr
.ColumnCount = 11
.ColumnHeads = True
' Scan the records from beginning to each
While Not rstVideos.EOF
' Check the current column
For Each fldEnumerator In rstVideos.Fields
' If the column is named Title
If fldEnumerator.Name = postcode Then
' If the title of the current record is "Congo"
If fldEnumerator.Value = sqlstr Then
' then change its value
rstVideos("Mailed").Value = "Yes"
' Move to the next record and continue the same approach
with this code currently nothign is being changed and no error messages are being reported.