473,753 Members | 7,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Runtime Error '3131'

4 New Member
Hi All,

I have encountered an annoying problem. I've read through all the post concerning this error. But yet, I still can't seem to solve the problem. When I run the program, it pops out this annoying error stating Run-time error '3131'. Syntax error in FROM clause. I've also read through salman1karim's post, and added spaces after and before a new line like told. And yet, it can't seem to solve the problem... Can anyone please help me? I'm very new to VB so, I might miss out something obvious...

Code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtSearch_Change()
  2.  
  3. If txtSearch.Text = vbNullString Then
  4.     Set rstSearch = dbsNormah.OpenRecordset("Children General Record", dbOpenTable)
  5.  Else
  6.    Set rstSearch = dbsNormah.OpenRecordset("Select * from Children General Record where Full Name = '" & txtSearch.Text & "' " & " & '*'")
  7.    End If
  8.     list
  9.      End Sub
  10.  
  11. Private Sub lstdata_Click()
  12.      Set rstSearch = dbsNormah.OpenRecordset("Select * from Children General Record where full name = '" & Trim(lstdata.list(lstdata.ListIndex)) & "'")
  13.  
  14.       rstSearch.MoveFirst
  15.       LblFullNameR.Caption = rstSearch("Full Name")
  16.       LblSurnameR.Caption = rstSearch("Surname")
  17.       LblICR.Caption = rstSearch("Identification")
  18.       LblTelR.Caption = rstSearch("Tel No")
  19.       LblSchoolR.Caption = rstSearch("School")
  20.       LblIDR.Caption = rstSearch("Patient ID")
  21.  
Thank you very much...
Dec 9 '06 #1
3 3289
willakawill
1,646 Top Contributor
Hi All,

I have encountered an annoying problem. I've read through all the post concerning this error. But yet, I still can't seem to solve the problem. When I run the program, it pops out this annoying error stating Run-time error '3131'. Syntax error in FROM clause. I've also read through salman1karim's post, and added spaces after and before a new line like told. And yet, it can't seem to solve the problem... Can anyone please help me? I'm very new to VB so, I might miss out something obvious...

Code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtSearch_Change()
  2.  
  3. If txtSearch.Text = vbNullString Then
  4.     Set rstSearch = dbsNormah.OpenRecordset("Children General Record", dbOpenTable)
  5.  Else
  6.    Set rstSearch = dbsNormah.OpenRecordset("Select * from Children General Record where Full Name = '" & txtSearch.Text & "' " & " & '*'")
  7.    End If
  8.     list
  9.      End Sub
  10.  
  11. Private Sub lstdata_Click()
  12.      Set rstSearch = dbsNormah.OpenRecordset("Select * from Children General Record where full name = '" & Trim(lstdata.list(lstdata.ListIndex)) & "'")
  13.  
  14.       rstSearch.MoveFirst
  15.       LblFullNameR.Caption = rstSearch("Full Name")
  16.       LblSurnameR.Caption = rstSearch("Surname")
  17.       LblICR.Caption = rstSearch("Identification")
  18.       LblTelR.Caption = rstSearch("Tel No")
  19.       LblSchoolR.Caption = rstSearch("School")
  20.       LblIDR.Caption = rstSearch("Patient ID")
  21.  
Thank you very much...
Hi you have to enclose the table name and field name in square brackets because it will not be recognised as a single name:

Expand|Select|Wrap|Line Numbers
  1. Set rstSearch = dbsNormah.OpenRecordset("Select * from [Children General Record] where [full name] = '" & Trim(lstdata.list(lstdata.ListIndex)) & "'")
Dec 9 '06 #2
babyspring
4 New Member
Thank you very much!
Dec 10 '06 #3
willakawill
1,646 Top Contributor
Thank you very much!
welcome very much :)
Dec 10 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
15123
by: Nathan Bloom | last post by:
Hi, I have a secured database that runs fine on the computer the database is installed on. I have several workstations with access runtime installed that also need access to the database. Access runtime runs fine when accessing an unsecured version of the database. However once the database was secured it generates a runtime error after asking for the user and password and won't open. The shortcut to the secured database is: "path...
2
3577
by: Paul | last post by:
I'm hoping someone can help me with the problem. I have a database where the default value for a date field in a table is =date() This works perfectly in my table and on my form. But when I complile the DB into a 97 Runtime, the date field displays and #error? in the runtime. But if I open the runtime db on a system with Access 97, there is no error. I have tried the runtime on mulitple systems (that dont have Access installed) and...
3
4809
by: priscilla.jenkins | last post by:
Alright, I'm really new to SQL and VBA and all this, so I might be completely off course...but just tell me. I know C and Assembly, but that doesn't help me much here. I'm trying to create a module that creates 5 queries (that a report is based on) based on a table that the user defines. My tables are named by date (not my choice), for example: -ArchivedActions05-20-05 Everything involving that seems fine. I'm getting a syntax error...
0
755
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. The same code works fine in a standalone app. I have inspected System.Runtime.Remoting.dll with ildasm, and I can see the ....Channels.Http namespace there. I verified that the virtual directory is configured to use v2.0.50727 (the error message...
399
12892
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or to python-3000@python.org In summary, this PEP proposes to allow non-ASCII letters as identifiers in Python. If the PEP is accepted, the following identifiers would also become valid as class, function, or variable names: Löffelstiel,...
7
8453
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then this installer will install them. But what about the situation where VC runtime has already been installed? In fact it's been installed twice. Although the project was built on a Windows XP system with Visual Studio 2005 SP1 and the results were...
1
4086
by: BL3WC | last post by:
Hi, I'd created a MDE under Access 2003. It is now under testing stage. Some of the users will use Access 2003 runtime and some will use Access 2007 runtime to run this MDE. I installed the Access 2007 runtime on a test machine and place the MDE in the Desktop for user's initial testing. I did not create a trust area for this MDE in the test machine as well as in my development machine. When I tested the MDE using /runtime switch in my...
0
9653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9421
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9333
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8328
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3395
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2284
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.