Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error 424 "Object Required" - Please Help

Posted on 2006-10-19
5
Medium Priority
?
264 Views
Last Modified: 2012-08-13
Hello experts,

I'm getting an error while looping through records in a table and can not figure out why.

==============================================================================

Private Sub txt_InPut_AfterUpdate()

    If IsNull(txt_InPut.Value) = False Then

    DoCmd.RunSQL ("INSERT INTO tbl_Main (txt_Content) VALUES ('" & txt_InPut.Value & "');")

    If txt_OutPut.Value <> "" Then txt_OutPut.Value = txt_OutPut.Value & vbCrLf
    txt_OutPut.Value = txt_OutPut.Value & txt_InPut.Value
    txt_InPut.Value = ""
    End If
   
Dim rst As DAO.Recordset
Dim x As String
Set rst = CurrentDb.OpenRecordset("SELECT txt_Content FROM tbl_Main")

rst.MoveFirst

Do Until rst.EOF
x = x & tbl_Main!txt_Content     <--------------------------------------------------------------THE ERROR HAPPENS HERE!
Me.txt_OutPut = vbCrLf & x
rst.MoveNext
Loop

Me.txt_InPut = ""

rst.Close
     
Requery
     
End Sub

==============================================================================
0
Comment
Question by:donniedarko801
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 34

Accepted Solution

by:
flavo earned 2000 total points
ID: 17770501
>x = x & tbl_Main!txt_Content  

Try:
x = x & rst!txt_Content  

Dave
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17770503
Having already opened the recordset (you did so for a reason) you use that surely?
x = x & rst!txt_Content    
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 17771174
to avoid future errors, that is if txt_Content might be left blank:

x = x & Nz(rst!txt_Content,"tbd")   'to be determined for string type

x = x & Nz(rst!txt_Content,0)    ' for number type

mike
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17771591
Other lads have sorted out your error

But...

Your loop is building x

I guess then u dont want to keep showing the building of x so I suggest u move this line out of the loop

Me.txt_OutPut = vbCrLf & x


0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 17771819
or

x = x & Nz(rst!txt_Content,"tbd")  & "; "
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question