Method or data member not found (1 Viewer)

luzz

Registered User.
Local time
Yesterday, 19:30
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: 292

isladogs

MVP / VIP
Local time
Today, 03:30
Joined
Jan 14, 2017
Messages
18,209
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:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:30
Joined
May 7, 2009
Messages
19,229
Check again
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:30
Joined
May 7, 2009
Messages
19,229
It's for rhe op. I have his database and the field is text.
 

luzz

Registered User.
Local time
Yesterday, 19:30
Joined
Aug 23, 2017
Messages
346
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
 

luzz

Registered User.
Local time
Yesterday, 19:30
Joined
Aug 23, 2017
Messages
346
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
 

isladogs

MVP / VIP
Local time
Today, 03:30
Joined
Jan 14, 2017
Messages
18,209
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 ...
 

luzz

Registered User.
Local time
Yesterday, 19:30
Joined
Aug 23, 2017
Messages
346
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
 

luzz

Registered User.
Local time
Yesterday, 19:30
Joined
Aug 23, 2017
Messages
346
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
 

Minty

AWF VIP
Local time
Today, 03:30
Joined
Jul 26, 2013
Messages
10,368
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.
 

luzz

Registered User.
Local time
Yesterday, 19:30
Joined
Aug 23, 2017
Messages
346
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

Top Bottom