473,396 Members | 1,995 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,396 software developers and data experts.

Type mismatch when select by ComboBox

I have two tables between them relationship, One of these tables is a Main-form and the other is Continuous Sub-form, The First Problem: when I put two Combo-box Wizard for find record from Main-form for Search, in query builder for these Combo-boxes appear two filed One of these filed FK and other filed with repeated data, and I make delete filed FK for unique value for other field, when go to form and select one of combo-box give me message "Type mismatch".

The second problem: from the same tables, Main-form and the other is Single Sub-form , i make Search by Text-box for sub-form, when Type Name give me "parameter value" and after press ok, the code go to First Record and Not the specified record.
thanks for help me.
by this code:


Expand|Select|Wrap|Line Numbers
  1. Private Sub ComSearch_Click()
  2. Dim KeyWord As String
  3. KeyWord = Me.txtSearch
  4. Me.Form.Filter = "Forms![AllNamesMain-1]![DetailsSub-1].Form![UserName] like '*" & KeyWord & "*'"
  5. ' DLookup("[UserName] ", "AllDetails", "UserNumber= '" & [UserName] & "' ")
  6. Me.Form.FilterOn = True
  7. Me.Form.FilterOn = False
  8. End Sub

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtSearch_AfterUpdate()
  2. Call ComSearch_Click
  3. End Sub
The file in this link:
https://www.mediafire.com/file/0leue...in%26Sub.accdb
Mar 8 '18 #1
7 2296
twinnyfo
3,653 Expert Mod 2GB
GoAccess,

Welcome to Bytes!

First, please use code tags when you post your code to this forum. I have edited your post so that it complies.

Second, in general, we are not going to download a database from a first-time user, for obvious security reasons.

Third, there appears to be a clear communication/language problem with your question. It is very difficult to decipher exactly what it is that you are asking--or what the specific problem is. However, I will try my best to look at what you've posted and make any comments/recommendations.

Concerning your first problem, it is unclear what the issue is, so I cannot comment.

In Line 4 of your first block of Code, the syntax you are using for a Filter is incorrect. Your Filter should simply be:

Expand|Select|Wrap|Line Numbers
  1. "[UserName] Like '*" & KeyWord & "*'"
In Lines 6 and 7, I am not sure why you are turning your Filter on and then immediately turning it off again. This could be why you are going to the first record and not the desired record(s).

Concerning your second procedure, I am not sure this is needed. You should put your code for ComSearch into the AfterUpdate procedure for the Text box OR keep it where it is, without a call to it from the AfterUpdate procedure. I can only see people wanting to search for something after they have updated the search field, but sometimes they want to click a button to search, rather than search automatically. Either way, it is not "wrong" to have it the way you have described.

As a side note, if you have two distinct problems/questions, we request you create two separate posts, so that each problem may be addressed individually. -Thanks from the Moderators!

Hope this hepps!
Mar 8 '18 #2
Thank you for reply and comments, and I would like to clarify : I have two forms (Main-form and the other is Continuous Sub-form) , (Main-form and the other is Single Sub-form)
by this link some picture for problem:
https://imgur.com/a/6StGe

Thank you again for help me.
Mar 8 '18 #3
twinnyfo
3,653 Expert Mod 2GB
I'm sorry but I can't access pictures on my work PC.

Also, pictures aren't going to help explain the problem. Concerning your first problem, A Type Mismatch error only occurs when you are trying to save data of one type into a variable or field that has an incompatible data type, for example saving a text string to an integer field.

However, you have not explained anything about your table structures, variables or forms that would give us any information on this. When is the error occuring? What line of your code is producing the error? This is the type of information we will need to help you.

Please provide additional, meaningful information relevant to your question so that we may more properly assist you.

Thank you.
Mar 8 '18 #4
I edit the link picture
Mar 8 '18 #5
I'm sure this link works ,You can download and see the file.
thank you for help me.
Mar 8 '18 #6
can now see the picture by this link:
https://imgur.com/a/6StGe
Mar 8 '18 #7
twinnyfo
3,653 Expert Mod 2GB
Please address the specific questions in Post #4. We can't solve a problem if we don't know the factors contributing to that problem.
Mar 8 '18 #8

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

Similar topics

2
by: mark | last post by:
I have a form with the following code on Click that calls a procedure passing a date data type value. The field in the table is a date/time data type. What is causing the type mismatch when it...
1
by: duha | last post by:
I get this "Run-Time error '13': Type Mismatch" when I run the sample code below. The debugger highlight the line "Set MSHFlexGrid1.DataSource = rs" Any ideas? I am using VB6. Thanks, duha ...
19
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without...
2
by: Eric | last post by:
Why it gives that error. Both tables have same type of number Data type mismatch qry = "SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology WHERE...
8
by: mjoytan | last post by:
In my real estate access database, I'm trying to create a report that will give me all the properties that are due for a lease renewal this year. I've been able to use datediff to tell me how...
5
by: daniel.hedz | last post by:
I am generating a usercontrol dynamically successfully, but when I try to find that usercontrol I get a type mismatch. This is what I am doing: //Loading my usercontrol...
6
by: foster99 | last post by:
Hi guys, Im trying to create a page using SQL and ASP. The SQL was working correctly untill I tried to introduce the use of variables so that I could grab two variables from two text boxes, and...
2
by: skundu | last post by:
Hi, I have just joined. I am getting a message when I am running a macro - run time error '13', type mismatch. when I am debuggung it it opens up my VBA code and shows this: Sub Updategraph()...
35
by: toadmaster | last post by:
I would greatly appreciate it if I could get help on the following code I keep getting a "Data Type mismatch" when I use the criteria (<120). It works fine when I take off the criteria. The...
4
anoble1
by: anoble1 | last post by:
I have an older database I am working with. Need some help. I have a function that creates a .SNP and opens a new email message and fills out the To and CC and attaches an attachment. No matter...
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: 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
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
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.