I have been getting this error:
"object doesn't support this object or method."
The debug is saying the problem is in the series of if statements based on which product I enter in the "drpProduct" control on the form. (Lines 26-48) -
Private Sub btnSave_Click()
-
-
'Automatically sets the Location of the transaction to SSP. -AJB 4/13/11
-
Me.txtLocation = "SCP"
-
-
'Makes sure a password is entered. -AJB 4/12/11
-
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
-
MsgBox "You must enter an authorization password.", vbOKOnly, "Invalid Entry"
-
Me.txtPassword.SetFocus
-
Exit Sub
-
End If
-
-
'Redirects an incorrect password -JLJ 4/12/11
-
If Me.txtPassword <> Me.txtPasswordLookup Then
-
MsgBox "You have entered an invalid EID/password.", vbOKOnly, "Invalid Entry"
-
Me.txtPassword.SetFocus
-
Exit Sub
-
End If
-
-
'If the transaction is Outbound, the stock adjustment number gets a negative sign added to the front of it. -AJB 4/12/11
-
If Me.drpIn_Out = "Outbound" Then
-
Me.txtStockAdjust = "-" & Me.txtStockAdjust
-
End If
-
-
'Sets the stockID of the current transaction. -AJB 4/13/11
-
If Me.drpProduct = "Sleeved DVDs" Then
-
Me.txtStockNum = 1
-
End If
-
-
If Me.drpProduct = "Cased DVDs" Then
-
Me.txtStockNum = 2
-
End If
-
-
If Me.drpProduct = "6x9 Envelopes" Then
-
Me.txtStockNum = 3
-
End If
-
-
If Me.drpProduct = "Booklets" Then
-
Me.txtStockNum = 4
-
End If
-
-
If Me.drpProduct = "Letters" Then
-
Me.txtStockNum = 5
-
End If
-
-
If Me.drpProduct = "Bibles" Then
-
Me.txtStockNum = 6
-
End If
-
-
'Makes sure all of the controls are filled. -AJB 4/12/11
-
If Me.drpIn_Out = "" Or Me.txtLocation = "" Or Me.drpProduct = "" Or Me.txtStockAdjust = Null Or Me.txtPackerEID = "" Or Me.txtAuthEID = "" Or Me.txtTransDate = "" Or Me.txtStockNum = Null Then
-
MsgBox "Make sure all fields are filled.", vbOKOnly, "Incomplete Form"
-
Exit Sub
-
End If
-
-
'Clears Password field. - AJB 4/15/11
-
Me.txtPassword = ""
-
-
'Set Saved checkbox to true which will enable user to close the form. -AJB 4/13/11
-
Me.chkSaved = True
-
-
'Everything was saved. -AJB 4/16/11
-
MsgBox "This inventory transaction was saved.", vbOKOnly, "Transaction Saved"
-
-
End Sub
-
-
Any kind of help would be greatly appreciated.
7 5603 NeoPa 32,556
Expert Mod 16PB
I'm confused as to why the line number is given as a range (26-48). In my experience only one line is highlighted when the error occurs (and that's the one we want to look at more closely).
For example, when I chose "Cased DVDs" line #31 is highlighted. Sorry for the confusion.
NeoPa 32,556
Expert Mod 16PB
Amy, you may want to consider a more succinct version of the code. This has many benefits, but one is that it's easier to ensure no errors get into the code. This code would replace your lines #25 to #48 : - 'Sets the stockID of the current transaction. -AJB 4/13/11
-
Select Case Me.drpProduct
-
Case "Sleeved DVDs"
-
Me.txtStockNum = 1
-
Case "Cased DVDs"
-
Me.txtStockNum = 2
-
Case "6x9 Envelopes"
-
Me.txtStockNum = 3
-
Case "Booklets"
-
Me.txtStockNum = 4
-
Case "Letters"
-
Me.txtStockNum = 5
-
Case "Bibles"
-
Me.txtStockNum = 6
-
End Select
Alternatively : - 'Sets the stockID of the current transaction. -AJB 4/13/11
-
With Me
-
.txtStockNum = Switch(.drpProduct="Sleeved DVDs",1, _
-
.drpProduct="Cased DVDs",2, _
-
.drpProduct="6x9 Envelopes",3, _
-
.drpProduct="Booklets",4, _
-
.drpProduct="Letters",5, _
-
.drpProduct="Bibles",6)
-
End With
NeoPa 32,556
Expert Mod 16PB
Is there anything special about Me.txtStockNum? All else being standard, it's unusual for a TextBox control to struggle with a simple numeric assignment. I don't suppose any of your other controls have problems when any data is assigned to them from your code?
As far as I can tell, this is the only problem. I will implement the Case statements as you've suggested and let you know the results, and if any other controls are giving me problems.
Thank you!
Thank you, NeoPa, this was helpful, and the code is working now.
NeoPa 32,556
Expert Mod 16PB
I'm very pleased to hear it Amy, but if I'm honest, also a little surprised. What I suggested was a reworking (albeit a little more efficiently), but not a fix to any perceived problem.
At the end of the day though, working code is generally a good thing (even if the understanding of the actual problem eluded us all).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: James |
last post by:
Hi,
I would like to run a custom script on a linux box via a button on a php
page (php webpage hosted on the same linux box).
Is this possible? If so , can you give me a pointer in the right...
|
by: hakim |
last post by:
Hi,
I need some information ?
How I can run my project (Php) on CGI.
Thanks.
|
by: Dica |
last post by:
i'm just learning java now, so this might be obvious, but not to me.
my app needs to do two things:
(1) connect to and fetch a list of tasks for a user from a web service
(2) connect to mapquest...
|
by: leroybt.rm |
last post by:
Can someone tell me how to run a script from a interactive shell
I type the following:
>>>python filename
>>>python filename.py
>>>run filename
>>>run filename.py
>>>/run filename
>>>/run...
|
by: Mactash |
last post by:
Folks,
I am trying just to run a simple asp commands in the
Internet Explorer. ( I have windows XP)
When I run this asp lines on ASP Matrix web server it is
ok.
But, when I run this on IIS...
|
by: SiuLoBow |
last post by:
Hi,
Is there anyway to detect the ActiveX control is able to run on the browser
or not?
After I installed the ActiveX control to my system, user sometimes switch
the secruity setting to "not...
|
by: Ed |
last post by:
Hello,
I took a course in asp about 2 years ago and I was
practicing with IIS 5.0. Then I put it down for a while.
Now trying to get back to it. I can't run asp files from
subdirectories of...
|
by: Jenna Olson |
last post by:
Hi all-
I've never seen this particular issue addressed, but was wondering if
there's anything to support one way or another. Say I have a class:
class ManipulateData
{
public:...
|
by: Brett Wesoloski |
last post by:
I am new to VS2005.
I changed my program.cs file to be a different form I am working on. But
when I go to run the application it still brings up the form that was
originally declared as new. ...
|
by: traceable1 |
last post by:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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: 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...
|
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...
| |