Type mismatch 10-03-07

I have received help previously for this problem but I am now having other 
problems that I can't work out. I want to be able to enter a tag number into 
a field on a form that will retrieve the record from the database table whose 
key matches the inputted tag number and display that record on the same form. 
The Tag number field field in the table is unique no duplicates allowed so 
there is only one record.

I am using Access 2000/2002 and have a form that has an unbound field that I 
have called FindRecord and have populated the rest of the form with the 
fields I require data to be inserted into from the database table.

As instructed I set up an event procedure as an afterupdate call and wrote 
the following code in the event procedure:

Private Sub FindRecord_AfterUpdate()
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[Tag Number] = " & Str(Me![FindRecord])
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
End Sub

I get an error type mismatch  '13' on the rs.Findfirst "[Tag Number] etc line.

The unbound field on the form is a text box and the table field tag number 
is text up to 15 characters. The data I have entered into the unbound field 
is B12346. I don't know why this is not bringing the data back into the 
fields and why it is not working. I need some more expert help.

Thanks in advance
Mabeline.
0
Utf
10/3/2007 1:52:01 AM
access.formscoding 7493 articles. 0 followers. Follow

4 Replies
746 Views

Similar Articles

[PageSpeed] 55

On Oct 3, 11:52 am, Mabeline <Mabel...@discussions.microsoft.com>
wrote:
> I have received help previously for this problem but I am now having other
> problems that I can't work out. I want to be able to enter a tag number into
> a field on a form that will retrieve the record from the database table whose
> key matches the inputted tag number and display that record on the same form.
> The Tag number field field in the table is unique no duplicates allowed so
> there is only one record.
>
> I am using Access 2000/2002 and have a form that has an unbound field that I
> have called FindRecord and have populated the rest of the form with the
> fields I require data to be inserted into from the database table.
>
> As instructed I set up an event procedure as an afterupdate call and wrote
> the following code in the event procedure:
>
> Private Sub FindRecord_AfterUpdate()
> Dim rs As Object
Hi Mabeline,

Since you are using a text field, you need to delimit the variable
with text delimiters.  If FindRecord does not contain any single-quote
(apostrophe) characters, you can use the single-quote character as the
delimiter:
  rs.FindFirst "[Tag Number] = '" & Str(Me![FindRecord]) & "'"
Expanded for clarity, that's:
  rs.FindFirst "[Tag Number] = ' " & Str(Me![FindRecord]) & " ' "

If FindRecord may contain a single-quote character, use a pair of
double-quote characters:
  rs.FindFirst "[Tag Number] = """ & Str(Me![FindRecord]) & """"
Again,expanded for clarity, that's:
  rs.FindFirst "[Tag Number] = " " " & Str(Me![FindRecord]) & " " " "

HTH,

Rob


> Set rs = Me.RecordsetClone
> rs.FindFirst "[Tag Number] = " & Str(Me![FindRecord])
> If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
> End Sub
>
> I get an error type mismatch  '13' on the rs.Findfirst "[Tag Number] etc line.
>
> The unbound field on the form is a text box and the table field tag number
> is text up to 15 characters. The data I have entered into the unbound field
> is B12346. I don't know why this is not bringing the data back into the
> fields and why it is not working. I need some more expert help.
>
> Thanks in advance
> Mabeline.


0
Rob
10/3/2007 2:15:28 AM
Rob, that might not work in this particular case.  The Type mismatch happens 
because the argument for the Str function must be numeric. In this case it 
is not.  Your solution will work if Mabeline removes the Str() surrounding 
the Me![FindRecord].

UpRider

"Rob Parker" <robert.parker@dsto.defence.gov.au> wrote in message 
news:1191377728.920541.8790@22g2000hsm.googlegroups.com...
> On Oct 3, 11:52 am, Mabeline <Mabel...@discussions.microsoft.com>
> wrote:
>> I have received help previously for this problem but I am now having 
>> other
>> problems that I can't work out. I want to be able to enter a tag number 
>> into
>> a field on a form that will retrieve the record from the database table 
>> whose
>> key matches the inputted tag number and display that record on the same 
>> form.
>> The Tag number field field in the table is unique no duplicates allowed 
>> so
>> there is only one record.
>>
>> I am using Access 2000/2002 and have a form that has an unbound field 
>> that I
>> have called FindRecord and have populated the rest of the form with the
>> fields I require data to be inserted into from the database table.
>>
>> As instructed I set up an event procedure as an afterupdate call and 
>> wrote
>> the following code in the event procedure:
>>
>> Private Sub FindRecord_AfterUpdate()
>> Dim rs As Object
> Hi Mabeline,
>
> Since you are using a text field, you need to delimit the variable
> with text delimiters.  If FindRecord does not contain any single-quote
> (apostrophe) characters, you can use the single-quote character as the
> delimiter:
>  rs.FindFirst "[Tag Number] = '" & Str(Me![FindRecord]) & "'"
> Expanded for clarity, that's:
>  rs.FindFirst "[Tag Number] = ' " & Str(Me![FindRecord]) & " ' "
>
> If FindRecord may contain a single-quote character, use a pair of
> double-quote characters:
>  rs.FindFirst "[Tag Number] = """ & Str(Me![FindRecord]) & """"
> Again,expanded for clarity, that's:
>  rs.FindFirst "[Tag Number] = " " " & Str(Me![FindRecord]) & " " " "
>
> HTH,
>
> Rob
>
>
>> Set rs = Me.RecordsetClone
>> rs.FindFirst "[Tag Number] = " & Str(Me![FindRecord])
>> If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
>> End Sub
>>
>> I get an error type mismatch  '13' on the rs.Findfirst "[Tag Number] etc 
>> line.
>>
>> The unbound field on the form is a text box and the table field tag 
>> number
>> is text up to 15 characters. The data I have entered into the unbound 
>> field
>> is B12346. I don't know why this is not bringing the data back into the
>> fields and why it is not working. I need some more expert help.
>>
>> Thanks in advance
>> Mabeline.
>
> 


0
UpRider
10/3/2007 2:34:43 AM
Thanks Rob this worked fine.

Could you help with when I open the form how do I start with blank fields 
rather then the first record details that are automatically displayed from 
the table.

Thanks again 
Mabeline.

"Rob Parker" wrote:

> On Oct 3, 11:52 am, Mabeline <Mabel...@discussions.microsoft.com>
> wrote:
> > I have received help previously for this problem but I am now having other
> > problems that I can't work out. I want to be able to enter a tag number into
> > a field on a form that will retrieve the record from the database table whose
> > key matches the inputted tag number and display that record on the same form.
> > The Tag number field field in the table is unique no duplicates allowed so
> > there is only one record.
> >
> > I am using Access 2000/2002 and have a form that has an unbound field that I
> > have called FindRecord and have populated the rest of the form with the
> > fields I require data to be inserted into from the database table.
> >
> > As instructed I set up an event procedure as an afterupdate call and wrote
> > the following code in the event procedure:
> >
> > Private Sub FindRecord_AfterUpdate()
> > Dim rs As Object
> Hi Mabeline,
> 
> Since you are using a text field, you need to delimit the variable
> with text delimiters.  If FindRecord does not contain any single-quote
> (apostrophe) characters, you can use the single-quote character as the
> delimiter:
>   rs.FindFirst "[Tag Number] = '" & Str(Me![FindRecord]) & "'"
> Expanded for clarity, that's:
>   rs.FindFirst "[Tag Number] = ' " & Str(Me![FindRecord]) & " ' "
> 
> If FindRecord may contain a single-quote character, use a pair of
> double-quote characters:
>   rs.FindFirst "[Tag Number] = """ & Str(Me![FindRecord]) & """"
> Again,expanded for clarity, that's:
>   rs.FindFirst "[Tag Number] = " " " & Str(Me![FindRecord]) & " " " "
> 
> HTH,
> 
> Rob
> 
> 
> > Set rs = Me.RecordsetClone
> > rs.FindFirst "[Tag Number] = " & Str(Me![FindRecord])
> > If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
> > End Sub
> >
> > I get an error type mismatch  '13' on the rs.Findfirst "[Tag Number] etc line.
> >
> > The unbound field on the form is a text box and the table field tag number
> > is text up to 15 characters. The data I have entered into the unbound field
> > is B12346. I don't know why this is not bringing the data back into the
> > fields and why it is not working. I need some more expert help.
> >
> > Thanks in advance
> > Mabeline.
> 
> 
> 
0
Utf
10/4/2007 3:09:00 AM
Thanks UpRider this worked fine.

Could you help with when I open the form how do I start with blank fields 
rather then the first record details that are automatically displayed from 
the table.

Thanks again 
Mabeline.


"UpRider" wrote:

> Rob, that might not work in this particular case.  The Type mismatch happens 
> because the argument for the Str function must be numeric. In this case it 
> is not.  Your solution will work if Mabeline removes the Str() surrounding 
> the Me![FindRecord].
> 
> UpRider
> 
> "Rob Parker" <robert.parker@dsto.defence.gov.au> wrote in message 
> news:1191377728.920541.8790@22g2000hsm.googlegroups.com...
> > On Oct 3, 11:52 am, Mabeline <Mabel...@discussions.microsoft.com>
> > wrote:
> >> I have received help previously for this problem but I am now having 
> >> other
> >> problems that I can't work out. I want to be able to enter a tag number 
> >> into
> >> a field on a form that will retrieve the record from the database table 
> >> whose
> >> key matches the inputted tag number and display that record on the same 
> >> form.
> >> The Tag number field field in the table is unique no duplicates allowed 
> >> so
> >> there is only one record.
> >>
> >> I am using Access 2000/2002 and have a form that has an unbound field 
> >> that I
> >> have called FindRecord and have populated the rest of the form with the
> >> fields I require data to be inserted into from the database table.
> >>
> >> As instructed I set up an event procedure as an afterupdate call and 
> >> wrote
> >> the following code in the event procedure:
> >>
> >> Private Sub FindRecord_AfterUpdate()
> >> Dim rs As Object
> > Hi Mabeline,
> >
> > Since you are using a text field, you need to delimit the variable
> > with text delimiters.  If FindRecord does not contain any single-quote
> > (apostrophe) characters, you can use the single-quote character as the
> > delimiter:
> >  rs.FindFirst "[Tag Number] = '" & Str(Me![FindRecord]) & "'"
> > Expanded for clarity, that's:
> >  rs.FindFirst "[Tag Number] = ' " & Str(Me![FindRecord]) & " ' "
> >
> > If FindRecord may contain a single-quote character, use a pair of
> > double-quote characters:
> >  rs.FindFirst "[Tag Number] = """ & Str(Me![FindRecord]) & """"
> > Again,expanded for clarity, that's:
> >  rs.FindFirst "[Tag Number] = " " " & Str(Me![FindRecord]) & " " " "
> >
> > HTH,
> >
> > Rob
> >
> >
> >> Set rs = Me.RecordsetClone
> >> rs.FindFirst "[Tag Number] = " & Str(Me![FindRecord])
> >> If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
> >> End Sub
> >>
> >> I get an error type mismatch  '13' on the rs.Findfirst "[Tag Number] etc 
> >> line.
> >>
> >> The unbound field on the form is a text box and the table field tag 
> >> number
> >> is text up to 15 characters. The data I have entered into the unbound 
> >> field
> >> is B12346. I don't know why this is not bringing the data back into the
> >> fields and why it is not working. I need some more expert help.
> >>
> >> Thanks in advance
> >> Mabeline.
> >
> > 
> 
> 
> 
0
Utf
10/4/2007 3:10:01 AM
Reply:

Similar Artilces:

multiple email addresses #10
Using Office 2007 and Windows XP Several of the people in my contacts folder have more than one address. I have both a personal email and a work email, but they have the same display name. For example: John Doe - jdoe@personal.com and then John Doe - jdoe@work.com When I type John Doe in the recipient box of a new email, I'd like to see both email addresses listed so that I can choose which one I want to use for this particular email. However, it seems that the email address defaults to whichever was the last one I used. Any way I can see both address show up so I can choose??...

Dividing All My Spreadsheet Entries By 10
Whenever I enter a figure into a cell in a spreadsheet it automatically divides the number I enterd by 10. How do I stop this please. I have tried re-installing and tried "Detect and Repair" - any idesa please. Hi David! Try: Tools > Options > Edit Remove check from "Fixed decimal places" -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. David, Type 10 in a free cell, go Edit > Copy or Ctl+C, then select the area you want to ...

Subreports 12-11-07
On my computer Access will not let me use the subreport wizard feature. How can I use this, and does anybody know if I can download this feature. Have you made sure that the wizard button (looks like a magic wand) before you try to add the subform control? If you're not sure what the wizard button looks like, it looks like this (this sample is from Access 2007 but the other versions look similar but it is on the tool bar just under, or to the right of, the cursor arrow button): http://downloads.btlarson.com/AWF/screenshots/ControlWiz/controlwiz01.png -- Bob Larson Access World Fo...

Pie of Pie Chart type with smaller pie showing slices of main slic
Hi How can I do the following: Lets say I have the following labels and data For the main pie I have A,B,C labels with A =5, B =10, and C =20. So my main pie would show 3 slices with C being the largest slice. To do this I highlight the 3 labels and their data and choose Insert, Pie, Pie in a Pie to show a main pie on the left with 3 slices and a smaller solid pie to the right with series lines connectiing them. I want to show the solid smaller pie on the right in several slices to show how the C slice of 20 is broken down. lets say the main slice C of 20 is made up ...

Typing in macros
I have made a few macros and use them in word and excel 2000. When I see typed out macros on the message boards I am not quite sure how to use them. Do I go into the editor, type them in and then link them with a button on the toolbar? What module do I put them in and is there one for the personal worksheet. I have been struggling with the syntax of Visual Basics for years. Just need a step by step explanation. Thank You Sue In general, the macros you see in the groups are likely to be ordinary macros that will go into a general module in the VBE, eg:- Hit ALT+F11 and this will...

multi-user problem 01-13-10
I have read many of the posts here and still can't seem to find an answer to this problem. I am using Access 2007, and fter successfully splitting my database and placing the FE on each local computers hard drive, I am still having problems getting access to allow mulitple users to use the forms etc in the front end at the same time. I get an error message saying that the table in the BE is in use and unavailable at this time. Please help. 1. Open your form in Design View and what is your form's 'Record Locks' property set to? If it is set to 'All Re...

Blocked features in Publisher '07 Free Trial?
I am trying to begin a booklet project with the free trial, but it appears certain functionalities are "grayed out" and unavailable to me in the menus. Can anyone direct me to a list of what features are unavailable in the trial version? Thanks in advance. -- -Ali There shouldn't be any features unavailable. Try setting up the booklet through the advanced page setup. File, Page setup, Advanced on the right. What features are unavailable to you? -- Mary Sauer http://msauer.mvps.org/ "ali" <ali@discussions.microsoft.com> wrote in message ...

Open File Dialog to fileter multiple file types at once...?
Hello, Here is another quick one for you all. The solution is probably simple, but I cannot find the answer anywhere. I have the following code: CFileDialog OpenDlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, ""); // Later must set this to retrieve a value from the registry OpenDlg.m_ofn.lpstrInitialDir = "c:\\"; OpenDlg.m_ofn.lpstrFilter = "txt Files\0*.txt\0Doc Files\0*.doc\0"; OpenDlg.DoModal(); I am trying to get the box to filter out everything but the *.doc and the *.txt files ... I have seen some boxes that have something that...

Rectification of wrong posting type
Hi There is one PL account say "Mic Expenses" has got wrong posting type "Balance sheet", when we closed the year 2005 ,System has brought forward the balance of that account into next year 2006, which otherwise should have been gone into the Retain Earning of 2006, is there any option to rectify this error, other then passing rectifying JV in 2005(coz in that case if I take last year TB then ending balance of this account would be Zero) or restoring the backup and doing closing procedure again. Thanks in Advance Shabnam There is a Article ID for this in partner s...

Some chart types cannot be combined with other chart types?
Hi, I am getting the above error message everytime I try to insert a chart or any type into a completely blank presentation using either the Insert, Chart command or the Insert Chart button in the Title and Content slide layout. I am using 2007. Any help or suggestions would be appreciated. TIA, Shane Devenshire Try running Office Diagnostics, Shane. Open PPT or Excel, hit the Office button, then <app> Options | Resources. I think that may resolve this issue. -- Echo [MS PPT MVP] http://www.echosvoice.com What's new in PPT 2007? http://www.echosvoice.com/2007...

need help to declard type=IntType instead type="xsd:int" with xml schema
Hi, I am writing C# code to produce xml schema. //Create attribute XmlSchemaAttribute att2 = new XmlSchemaAttribute(); att2.Name = "CustomerID"; att2.SchemaTypeName = new XmlQualifiedName("int",schemaNS); att2.Use = XmlSchemaUse.Required; ct.Attributes.Add(att2); I need to produce schema with custom data type instead of the xsd:string or xsd:int The code above will produce the following schema <?xml version="1.0" encoding="utf-8"?> <xsd:schema attributeFormDefault="unqualified" version="1.0" xmlns:xsd=...

GP 10 Upgrade Errors
I am trying to upgrade from GP version 7.5 to GP 10.0 I upgraded tp GP 9.0 Sp2 with minimal issues, and can install GP 10.00 and upgrade dynamics without issue. However when I attempt to run the upgrade on the company databases I Received errors on the following tables: Budget Summary Master Distribution Account Master Purchasing Report Options XLImport Error Code (0) Other Error (135) The conversion process encountered an error and the temporary table fif not get removed. Two of these tables have data and I do not know how to proceed and don't believe these are "temp" tabl...

How do I round up to the nearest 10?
Can anyone show me a formula to take any value in a cell and round it up to the nearest user defined 10, 20, 50, etc.? To round to the nearest 10, you can use this =round(b4,-1 "b4" is the cell reference. You would choose would cell the number you want to round is in tj =CEILING(A1,X) where X = the rounding criterion. For instance, to round up to the nearest 10: =CEILING(A1,10) HTH Jason Atlanta, GA >-----Original Message----- >Can anyone show me a formula to take any value in a cell and round it up to the nearest user defined 10, 20, 50, etc.? >. > Hi Fred i...

Connecting Entourage ver. 10 to exchange 2003
I am trying to connect entourage version 10 (MAC) to exchange 2003. I need help from the beginning to the end. ...

Office 10.1.5 Update Crashes
I'm trying to update Office X from 10.1.4 to 10.1.5 but keep getting the following error message: "an error prevented the update from completing 11002:2,-15" I tried to re-install 10.1.4 to see if that helped and got the same message. Any suggestions? Thanks. In article <b32a0e6e.0309071213.421bc8b8@posting.google.com>, tony.haskett@verizon.net (Tony H) wrote: > I'm trying to update Office X from 10.1.4 to 10.1.5 but keep getting > the following error message: > "an error prevented the update from completing 11002:2,-15" > > I tried to r...

Scatterplots with different colors based on Type of Data
Is it possible to plot a scatterplot with different colors for 2 sets of data? E.g Type of Agreement MRP Discount% Limited 10 5% UnLimited 20 10% I want to show different colors for Limited & Unlimited. Is it possible to plot scatterplots on both axis(Primary & Secondary) Please let me know. Thanks, Satish If I use this range to make a chart Limited 10 5% Unlimited ...

outlook type interface
I have an SDI application and want to change it so I have a split window, on the left I want a TreeControl above a 'PropertyGrid' control. Then my exisiting SDI Client in the space on the right Can anyone point in the right direction to achieve this Any help will be much appreciated Thanks Phil You need to use two CSplitterWnds (as members of your CMainFrame). Override CMainFrame::OnCreateClient and create a vertical splitter as the main child (i.e. 1 row, 2 cols). Then you want to create a horz splitter as a child of the left-hand pane of the main splitter (which has 2 rows, 1 c...

Customization 05-10-04
Hi, As mentioned in my previous post,I'm new to MS-CRM and tried to implement the example of reating a business unit but am not able to get it going.I've not cut and paste the code,I've changed the server address and other relavant places.But still unsuccessful in executing it. Can someone help me out in this?Is there any particular way to execute this program?I'm creating a new ASP.Net application and writing this code and executing it.Is this right or is there something else I should be doing. Suggestions or help appreciated. Regards, ...

Is this possible? 08-27-03
I need to work on a program that was created in dBase and since I'm not to familiar with dBase, I'm wondering if I can convert the dBase program to an Access database so I can create queries and generate the specific reports I need. Thanks in advance for your assistance with this...I really need to get cracking on this..I have reports that are due by the end of September. Again, Thanks!! :) K- ...

VSTO Excel 2003 to VB 6.0 Type mismatch
Hi, I have an Addin 2003 Application. In this Application I'm calling an VB 6.0 Dll and I send Excel Application Object as Parameter. In VB Project I'm using Workbook_Open event with WithEvents. I have a messagebox there. Unfortunately when i call VB dll , I get this Error Message -- > Type mismatch. Is there any Idea? Code in VS2008 : private Project1.Class1 vbapp; private void ThisAddIn_Startup(object sender, System.EventArgs e) { #region VSTO generated code this.Application = (Excel.Application)Microsoft....

forms 05-15-10
when i launch my form it takes quite a bit of time to release control to the mouse for me to do anything. my form has subforms, buttons, edit boxes, etc. what is the reason behind this dalay?. it is annoying. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201005/1 You're sitting in front of your database, we're not! If you want us to help you'll have to do a much better job of telling us about your form! Is there code in the Form_Open or Form_Load events of your form? If so, copy and paste it here. Is your form ...

predictive typing of addressee
I am frequently sending sensitive email to a person who has a very common name. More than once I have almost sent the email to the wrong party because of the Outlook feature that predicts the addressee name. Does anyone know how to eliminate names from the dropdown list that appears as you type tha addressee name? Or is there a way to stop addressee names from appearing automatically as you type in the "To" field. Any help will be appreciated. joanne Use arrow keys to highlight error address, then hit Delete Btn Do you use Contacts?, hitting the 'To' Btn will bri...

"Can't change data type" error
I'm trying to reduce the field size of text fields in my database. They defaulted to 255 characters when I created my database but in many cases I only need a size of around 20. When I enter the reduced size for one field in the table design view and try to save the change to that field I get the following errors: "Microsoft Access can't change the data type. There isn't enough diskspace or memory." When I click OK to the above I then get the following message: "Errors were encountered durnig the save operation. Data types were not changed. Properties w...

How to convert CString type to LPCSTR type
Hi, I have a CString type variable, and I need to convert it's to LPCSTR type ,what I can do! example: CString m_strExecFile(_T("C:\\\\aa.exe")); next I want to call WinExec Command to execute this file LPCSTR lpcstr ; lpcstr = m_strExecFile.GetBuffer(); WinExec(lpcstr,SW_SHOW); BUT the compilier tells me it can not convert w_char * to LPCSTR type! Why? ps. I use vs2005 program in UNICODE mode. Any helpful ideas would be highly appreciated! -joseph Why use a CString in this case at all, if all you are doing is using it in WinExec. Something ...

sending email #10
when I write a new email or reply to an email, I am unable to send it. I have to close it and it goes into the draft file, where I then move it to the outbox. Even in the outbox I am unable to send it. Please help me. Thank you. Post your Outlook version, Account type and connection type. What do you show in your send/receive groups? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. After searching google.groups.com and finding no answer: revpena@gracefullivingministries.org <anonymous@discussions.microsoft.com> asked: | when I ...