473,398 Members | 2,389 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,398 software developers and data experts.

Wondering why "TYPE MISMATCH"

Hello
This is not a big problem, but I was hoping someone a bit more
knowlegable than I could explain something to me.

I have a simple function behind a form which writes changed values to
a table for tracking purposes :

Public Sub RecordChanges()
Dim strInsertValue As String
strInsertValue = "INSERT INTO
tblChanges(ChangedField,OldValue,NewValue,ChangeDa te,User,OrderNum)
VALUES ("
strInsertValue = strInsertValue & "'" &
Me.ActiveControl.Properties.Item(1) & "', '" &
Me.ActiveControl.OldValue & "', '" & Me.ActiveControl & "', #" & Date
& "#, '" & Forms("frmLogin")("txtUserName") & "', '" & Me.ORDER_NUMBER
& "')"
DoCmd.SetWarnings (False)
DoCmd.RunSQL strInsertValue
DoCmd.SetWarnings (True)
End Sub

This code works fine when it is behind the form in question, however I
tried to move the function to a module, for house-keeping, and because
I might want to use it in other forms.
I changed it slightly to:

Public Sub RecordChanges(sendingForm as Form)

And changed the "me"'s to "sendingForm"s, and assumed it would work,
however it doesn't and I get a type mismatch error.

Any idea why?
Cheers
Andrew
Nov 13 '05 #1
2 1818
OK, once again I am struck dumb with my own idiocy. Of course I need to
"Call" the sub as its a sub not a function...I shouldn't try to do 2
things at once, like breathe and write vba, it makes my brain hurt :P
Andrew

Nov 13 '05 #2
Andrew Proctor wrote:
OK, once again I am struck dumb with my own idiocy. Of course I need to
"Call" the sub as its a sub not a function...I shouldn't try to do 2
things at once, like breathe and write vba, it makes my brain hurt :P
Andrew


Why, if asking the question enables you to see the answer, by all means
go ahead!

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dmgauntt2002 | last post by:
I have some javascript ASP code that sets the expiry date on a cookie to five years from now. The code worked until today, when I got the following error message: Microsoft JScript runtime...
1
by: Brian Begy | last post by:
Anyone seen this? "Type mismatch could be due to the mixing of a file reference with a project reference " We have solution we are trying to upgrade to VS 2005. We have about 10 projects in...
1
by: melda | last post by:
I am a real beginnner in ASP. Due to increasing demands on dynamic website, I've been working on ASP website now. I use a ready to use CMS program and right now I've been trying to combine a calendar...
1
by: ApexData | last post by:
Access2k I WAS getting the following error when using the MID function: Run Time Error '13' Type Mismatch I have a new single form, unbound with 1-button on it that uses the following code:...
5
by: Davros9 | last post by:
Trying to get Regular Expressions working....... ---------------- Public Function SepString(InField As String) As String ''seperates on space and comma Dim RE As New RegExp Dim Matches As...
17
imrosie
by: imrosie | last post by:
I've tried this string to Sum up payments, moving brackets and paren's different ways, I still get error 'type mismatch'....not sure why. Can anyone point me in the right direction?? thanks ...
10
by: dstorms | last post by:
Hi, I'm trying to create a button on a form that: 1. Takes the ComputerID from the form linked to Table 1, 2. Checks Table 2 for a matching ComputerID, and 3. Opens the query qryEditData, and...
3
by: bxscikid | last post by:
I am using VB 6 in order to clear a listbox (lststuff) containing material entered by the user via input boxes. I am trying to utilize a command button which will clear the list for the user. When...
3
by: martin DH | last post by:
I would definitely appreciate any help with this problem as soon as possible. Thanks! I have a report that should display the results of a query based on two tables (tblClient and tblResult,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
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...
0
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...

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.