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

Type Mismatch

Private Sub search_list(ByRef house_details() As house_record)

Expand|Select|Wrap|Line Numbers
  1. Dim price_target As Currency
  2. Dim type_target As String
  3. Dim postcode_target As String
  4. Dim counter As Integer
  5. Dim temp_postcode As String
  6.  
  7. postcode_target = cboOne.Text
  8. price_target = cboTwo.Text   'Type Mismatch "13"
  9. type_target = cboThree.Text
  10.  
  11. For counter = 1 To 7
  12.  
  13. temp_postcode = house_details(counter).postcode
  14. temp_postcode = Left(temp_postcode, 3)
  15.   If postcode_target = temp_postcode Or postcode_target = "All" Then
  16.      If price_target = house_details(counter).price Or price_target = "Any" Then
  17.         If type_target = house_details(counter).house_type Or type_target = "Any" Then
  18.  
  19.           OutputForm.txtAddress.Text = house_details(counter).address
  20.           OutputForm.txtPostcode.Text = house_details(counter).postcode
  21.           OutputForm.txtPrice.Text = house_details(counter).price
  22.           OutputForm.txtType.Text = house_details(counter).house_type
  23.           OutputForm.txtStatus.Text = house_details(counter).status
  24.  
  25.       Else
  26.           MsgBox ("No matches for your search criteria")
  27.       End If
  28.     End If
  29.   End If
  30. Next
  31.  
  32. End Sub
I don't know what to do. :(
Dec 8 '11 #1
3 1678
Stewart Ross
2,545 Expert Mod 2GB
Your price_target variable is defined to be of type currency. What is the value in the combo when the error occurs?

You could try using the CCur function to coerce the value returned from cboTwo to currency as follows:

price_target = CCur(cboTwo.text)

but we really need to know more about the value of the combo when the error occurs.

-Stewart
Dec 8 '11 #2
I think it's mainly because I'm using numbers. The search values stored in cboTwo has string contents such as a pound sign. (£) Is there a way to get around this? (Total novice here).
Dec 9 '11 #3
Stewart Ross
2,545 Expert Mod 2GB
The type conversion function CCur works fine when faced with the local currency sign prefixing a numeric string (the prefix being the UK pound sign in this case).

Have you tried the explicit typecasting using CCur I suggested above? It does not error when faced with a text string representing an amount in UK pounds.

-Stewart
Dec 9 '11 #4

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

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
1
by: crookward | last post by:
I usually have no problem identifying a type mismatch error, but this one's got me pulling my hair out. The mismatch error is pointing to line 269, which is a blank line, and it's also within an if...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.