Method or data member not found

luzz

Registered User.
Local time
Today, 06:29
Joined
Aug 23, 2017
Messages
346
Hi guys, I am facing issue with my code whereby it show me method or data member not found.
I check the spelling of my code against my textbox on the form and they are the same! Besides that, I am sure this code is working as i am using the exact
code on my another form and it is working! so I really has no clue on where did I go wrong. Can someone help me please
 

Attachments

  • error.png
    error.png
    41.8 KB · Views: 477
You have used text delimiters
If it's a number field you need to remove these & change the line to:

Code:
", Fabrication = " & Me.txtFabrication & "" & _

BTW Please post code using code tags rather than a screengrab
This makes it easier to reply using copy & paster rather than having to retype the code

EDIT: Does the textbox txtFabrication exist?
 
Last edited:
Check again
 
It's for rhe op. I have his database and the field is text.
 
You have used text delimiters
If it's a number field you need to remove these & change the line to:

Code:
", Fabrication = " & Me.txtFabrication & "" & _

BTW Please post code using code tags rather than a screengrab
This makes it easier to reply using copy & paster rather than having to retype the code

EDIT: Does the textbox txtFabrication exist?

Ok, noted. Yes, it does exist
 
You have used text delimiters
If it's a number field you need to remove these & change the line to:

Code:
", Fabrication = " & Me.txtFabrication & "" & _

BTW Please post code using code tags rather than a screengrab
This makes it easier to reply using copy & paster rather than having to retype the code

EDIT: Does the textbox txtFabrication exist?
I now face syntax error
CurrentDb.Execute "UPDATE mxd" & "SET ID = " & Me.txtID & _
", GLGPO = " & Me.txtGLGPO & "" & _
", GLA = " & Me.txtGLA & "" & _
", StyleNo = " & Me.txtStyleNO & "" & _
", Content = " & Me.txtContent & "" & _
", FabricDelivery = " & Me.txtFabricDelivery & "" & _
", Fabrication = " & Me.txtFabrication & "" & _
", FabricCuttableWidth = " & Me.txtWidth & "" & _
", Color = " & Me.txtColour & "" & _
", LBS = " & Me.txtLbs & "" & _
", Yds = " & Me.txtYds & "" & _
" WHERE ID = " & Me.txtID.Tag
 
You've removed all the text delimiters.
That would be OK if all the fields are numbers but not if they are text!

So if StyleNo is a number & Content is text, those 2 lines would be:

Code:
", StyleNo = " & Me.txtStyleNO & "" & _
", Content = '" & Me.txtContent & "'" & _

etc ...
 
You've removed all the text delimiters.
That would be OK if all the fields are numbers but not if they are text!

So if StyleNo is a number & Content is text, those 2 lines would be:

Code:
", StyleNo = " & Me.txtStyleNO & "" & _
", Content = '" & Me.txtContent & "'" & _

etc ...

I tried and i am still facing error
 
Have you checked each line in your SQL statement & corrected it for text/number fields in each case?

I have no idea if having two subform on a form is causing the code to prompt me error
 
Nope it won't be that. Post up the code as you have it now. And I would build the string before trying to execute as it's much easier to Debug it, so something like;
Code:
	Dim sSql As String
	
	sSql = "UPDATE mxd SET ID = '" & Me.txtID "' "
	sSql = ssql & ", GLGPO = '" & Me.txtGLGPO & "' " 
	sSql = ssql & ", GLA = '" & Me.txtGLA & "' " 
	sSql = ssql & ", StyleNo = '" & Me.txtStyleNO & "' "
	sSql = ssql & ", Content = '" & Me.txtContent & "' "
	sSql = ssql & ", FabricDelivery = '" & Me.txtFabricDelivery & "' "
	sSql = ssql & ", Fabrication = " & Me.txtFabrication & "' "
	sSql = ssql & ", FabricCuttableWidth = " & Me.txtWidth & " "
	sSql = ssql & ", Color = " & Me.txtColour & "' " 
	sSql = ssql & ", LBS = " & Me.txtLbs " "
	sSql = ssql & ", Yds = " & Me.txtYds & " "
	sSql = ssql & " WHERE ID = " & Me.txtID.Tag

	Debug.print sSql

	CurrentDb.Execute sSql
I've made assumptions about text and number fields - you'll need to sort that out.
If it doesn't work - look at the immediate window in the VBA editor - cut and paste the code into a new query window and see what error it gives you.
 
Nope it won't be that. Post up the code as you have it now. And I would build the string before trying to execute as it's much easier to Debug it, so something like;
Code:
	Dim sSql As String
	
	sSql = "UPDATE mxd SET ID = '" & Me.txtID "' "
	sSql = ssql & ", GLGPO = '" & Me.txtGLGPO & "' " 
	sSql = ssql & ", GLA = '" & Me.txtGLA & "' " 
	sSql = ssql & ", StyleNo = '" & Me.txtStyleNO & "' "
	sSql = ssql & ", Content = '" & Me.txtContent & "' "
	sSql = ssql & ", FabricDelivery = '" & Me.txtFabricDelivery & "' "
	sSql = ssql & ", Fabrication = " & Me.txtFabrication & "' "
	sSql = ssql & ", FabricCuttableWidth = " & Me.txtWidth & " "
	sSql = ssql & ", Color = " & Me.txtColour & "' " 
	sSql = ssql & ", LBS = " & Me.txtLbs " "
	sSql = ssql & ", Yds = " & Me.txtYds & " "
	sSql = ssql & " WHERE ID = " & Me.txtID.Tag

	Debug.print sSql

	CurrentDb.Execute sSql
I've made assumptions about text and number fields - you'll need to sort that out.
If it doesn't work - look at the immediate window in the VBA editor - cut and paste the code into a new query window and see what error it gives you.

I will try out tomorrow, thank you:)
 

Users who are viewing this thread

Back
Top Bottom