473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

INSERT INTO - method or data member not found

I am hoping someone can help me as I've done this sort of thing before with no problems. I am using Access 2003 SP2 on WinXP prof SP2

I have an unbound form (single form view) with 18 unbound text controls and a command button. I am trying to have this code on 'On Click' Event of the button to insert the data into a table (which has an autonumber PK)

Expand|Select|Wrap|Line Numbers
  1. Dim sSQL As String
  2.     sSQL = " INSERT INTO tbl_ScribalMain " & _
  3.     "(CompName, ContactName, [Position], DelAddress1, DelAddress2, DelTown, DelPCode, Country, Phone, Fax, Mobile, Email, [Website], BusinessType, [Group], ABN, Notes, [ReSubCalls-Comments])" & _
  4.     "VALUES('" & Me.txtCompName & "', '" & Me.txtContactName & "', '" & Me.txtPosition & "', '" & Me.txtAddress1 & "', " & _
  5.     "'" & Me.txtAddress2 & "', '" & Me.txtTown & "', '" & Me.txtPCode & "', " & _
  6.     "'" & Me.txtCountry & "', '" & Me.txtPhone & "', '" & Me.txtFax & "', '" & Me.txtMobile & "', '" & Me.txtEmail & "', " & _
  7.     "'" & Me.txtWebsite & "', '" & Me.txtBusType & "', '" & Me.txtGroup & "', '" & Me.txtABN & "', " & _
  8.     "'" & Me.txtBusNotes & "', '" & Me.txtComments & "');"
  9.  
  10.     DoCmd.RunSQL sSQL
I am receiving a 'method or data member not found' error when I try to compile or run the code. The highlighted member is Me.txtWebsite
It is spelled correctly
I initially tried it without the "Dim sSQL As String", just going "DoCmd.RunSQL etc, but it didn't make any difference.
The thing that kills me is that this is my second attempt.
On my first attempt I used a form that was bound to the Table and the text controls were bound to their respective fields in the table. I removed the 'Control Source' from all fields and the form, making it unbound and had the same problem but with Me.txtPosition which is third VALUE parameter in code.
To make sure there wasnt something strange coming across with old form I started from scratch with a brand new, unbound form and created and named all the fields, and now the error is on Me.txtWebsite which is the tenth VALUE parameter in the code.
I have check all the spellings over and over. I have made sure that the code is in the same order that the fields appear on the table.
Any help at all with this would be greatly appreciated as I am running out of hair to pull out.
Thanks in advance.
May 30 '08 #1
1 2935
Stewart Ross
2,545 Expert Mod 2GB
Hi. Your code seems OK, at least syntactically. The error message is telling you that there is apparently no control of the name given, txtWebsite, on that form, even though you have checked the spelling and so on.

Given that you have been using unbound controls for some reason I am sure you are aware that the names you are referring to in the Values section of the SQL are of the controls on the form, not the fields in the table. The control's name as used on the form must be what you refer to in the code.

I would check that the control is indeed named txtWebsite and not, say txtWeb Site which you would have to refer to within brackets, or txtWebsite_ (where the underscore means an extra space). Although you are using the dot property form of the Me reference this should not make a difference here (the normal form of control reference uses Me![Control Name], or Me!ControlName if without spaces).

The VB editor should be able to help you as it will show you all the properties and control names of the form after you type me. You can scroll the list of controls/properties and check what the actual name of the control is - the list will mostly show underscores in place of any spaces in the names listed (although I have also seen the list show bracketed names with spaces in this circumstance).

Let us know how you get on.

-Stewart
May 30 '08 #2

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

Similar topics

2
by: Jan van Veldhuizen | last post by:
I try to use the Server Data on Insert property to return a column value swhich is set in a trigger. But it does not work. Why not? What am I doing wrong? (BTW I'm using Oracle version 10) My...
2
by: php newbie | last post by:
Hello, I am trying to load a simple tab-delimited data file to SQL Server. I created a format file to go with it, since the data file differs from the destination table in number of columns. ...
6
by: gustav04 | last post by:
hi all i have a question: what is the difference between a c-function and an c++ class method (both do exactly the same thing). lets say, i have a function called print2std() and a class...
2
by: Bill | last post by:
I'm having what seems to me to be an odd problem. Perhaps there is some explanation, but don't know at this point. Basically I have a form that tracks memberships and donations. The main form...
2
by: Nothing | last post by:
I have a form that a person enters some information on. They then clicka button that triggers VBA to perfom a SQL INSERT INTO query. One of the fields auto assignes the current date. Another...
5
by: kuvpatel | last post by:
Hi I want to refer a class called LogEvent, and use one of its methods called WriteMessage without actually having to create an instance of Logevent. I have tried using the word sealed with...
10
by: Mike | last post by:
I know this sounds strange but I am at a loss. I am calling a simple funtion that opens a connection to a SQL Server 2000 database and executes an Insert Statement. private void...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
5
by: vin b | last post by:
Hi, How would I invoke a method on a reference to an STL object (STL map in this case) In this contrived example, I want to invoke the insert() method on localmap? Thanks, Vin
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.