Need help with a loop

alloyd1

Registered User.
Local time
Today, 12:31
Joined
Jul 15, 2007
Messages
16
Need help having a field named [inputted] updated to Yes in the Table [TBL_Ready] . I am not using a yes/no field type, just a standard text type. Can someone please tell me how to do it?



Public Function ImacroIE()
On Error GoTo Err_ImacroIE_Click
Dim rs, iim1, sql
Dim myname, mypath, connstring
Dim iret

SOURCE=C:\Documents and Settings\All Users\Documents\Imacros\datasources\Clist_data.MDB"

Set rs = CreateObject("ADODB.Connection")
connstring = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\Documents and Settings\All Users\Documents\Imacros\datasources\Clist_data.MDB"

rs.Open (connstring)

sql = "select * from tbl_READY"
Set rs = rs.Execute(sql)
Set iim1 = CreateObject("Imacros")
iret = iim1.iimInit
iret = iim1.iimDisplay("Submitting Data from MS ACCESS")
Do Until rs.EOF
iret = iim1.iimSet("-var_Link_SignUP", rs.Fields(0))
iret = iim1.iimSet("-var_Title", rs.Fields(1))
iret = iim1.iimSet("-var_MUID1", rs.Fields(2))


iret = iim1.iimPlay("CraigsList-IE3")
If iret < 0 Then
MsgBox iim1.iimGetLastError()
End If
rs.MoveNext
Loop
iret = iim1.iimDisplay("Done!")
iret = iim1.iimExit

Exit_ImacroIE_Click:
Exit Function
Err_ImacroIE_Click:
MsgBox Err.Description
Resume Exit_ImacroIE_Click
End Function
 
Need help having a field named [inputted] updated to Yes in the Table [TBL_Ready] . I am not using a yes/no field type, just a standard text type. Can someone please tell me how to do it?

Is that not just a simple update query?

Brian
 
I did try adding this statement right after Do Until re.EOF and it did not work.

DoCmd.RunSQL "UPDATE Table1 SET Table1.inputted = -1;"

Am I missing something? All I want is the one record that is selected at the time of the loop to be updated.
 
a,

I am not using a yes/no field type, just a standard text type.

DoCmd.RunSQL "UPDATE Table1 SET Table1.inputted = -1;"

Inputted is a text field ... right?

CurrentDb.Execute "UPDATE Table1 SET Table1.inputted = 'YES';"

or 'Y' or 'Yes'.

Wayne

Edit: The above will set ALL rows. You don't need the code.
 
I added that code and I get the following message:
"The Microsft Office Access databse engine cannot find the input table or query "Table1". Make sure it exists and that its name is spelled correctly."

I confirmed names and it is not working. Also, I only would like to update each record as it is looped.

What I am doing is having multiple people read from the same table, I want it selected as inputted so it will skip the record and move to the next as it loops. Ultimately, I would like the record copied to a differnt table and then deleted after the loop is completed with the current record.
 
alloyd1,

But, it said Table1 in your example ...

Inside your loop add:

rs.Edit
rs!inputted = "YES"
rs.Update

Wayne
 
Ok, now I get the following message:
"Object doesn't support this property or method"

I put the code right under Do Until rs.EOF

Am I missing something?
 

Users who are viewing this thread

Back
Top Bottom