DataType Mismatch

Bigmo2u

Registered User.
Local time
Today, 04:43
Joined
Nov 29, 2005
Messages
200
Having a an issue and not sure how this is happenning because I have used this code in a lot of forms.
Code:
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[OwnerID] = '" & Me![lstUsers] & "'"
Me.Bookmark = rs.Bookmark [COLOR="SeaGreen"]<---- error is here for the datatype mismatch or No record found[/COLOR]

OwnerID is a string.

I have tried

Code:
rs.FindFirst "[OwnerID] = '" & Me.lstUsers & "'"
Me.Bookmark = rs.Bookmark

I have tried

Code:
Set rs = Me.Recordset.Clone
rs.FindFirst "[OwnerID] = " & Me![lstUsers] 
Me.Bookmark = rs.Bookmark

Not sure how to fix this issue, any help would be greatly appreciated.
 
pr2-eugin ~ Thank you for the advice, but I know the record is there. they can only select from a listbox of choices, so they can't enter there own data to do the search.
 
Dim RS as Dao.Recordset

Bookmark is a part of a recordset, you need to define your RS as a DAO.Recordset....

NOTE the DAO, to make sure you get a DAO one, not a ADO one.... becuase you will get the same error message if you get an ADO recordset since forms are DAO.
 
Changed to rs As DAO.Recordset and still get he same error.

Now and I am getting no record found.
 
What is the value you are getting from the Listbox? check that properly.
 
What value/s are shown in message box if you use:
Code:
Msgbox Me.lstUsers & " and " & Me!lstUsers
rs.FindFirst "[OwnerID] = '" & Me![lstUsers] & "'"
Me.Bookmark = rs.Bookmark <
 
Bob if I change it variable back to

rs as Object

I get lthompson and ltompson in the msgbox
 
Please answer Paul's question post #9 and mine post #10
 
pr2-eugin properties are as follows:

Bound Column 1
Column Count 2 column 1 = OwnerID COlumn 2 = FullName
Column widths = 0";1.5"
 
Bob

Rowsource Property is:

SELECT tblOwner.OwnerID, tblOwner.FullName FROM tblOwner WHERE (((tblOwner.OwnerID)<>"<---SELECT--->"));
 
What result do you get if you use:
EDIT
Code:
[COLOR="red"][B]Dim [COLOR="Red"][B]DAO[/B][/COLOR].rs As Recordset
[/B][/COLOR]
Set rs = Me.Recordset.Clone
Msgbox Me.lstUsers
rs.FindFirst "[OwnerID] = " & Me.[lstUsers]
Me.Bookmark = rs.Bookmark
 
Compile error:

Syntax error

Code:
DAO.rs AS Recordset
 
No current record found '3021', but the msgbox is still showing the names.
 
If i do:
Code:
rs.FindFirst "[OwnerID] =  " & Str(Me.lstUsers)

I get dataType mismatch
 
And using:
Code:
Dim rs As DAO.Recordset

Set rs = Me.Recordset.Clone
Msgbox Me.lstUsers.Column(0) & " : " & Me.lstUsers.Column(1)
rs.FindFirst "[OwnerID] = " & Me.lstUsers.Column(0)
Me.Bookmark = rs.Bookmark
 

Users who are viewing this thread

Back
Top Bottom