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
Solved

Error 424 "Object Required" - Please Help

Posted on 2006-10-19
5
258 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
5 Comments
 
LVL 34

Accepted Solution

by:
flavo earned 500 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

861 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