书签数据类型不匹配错误 [英] Bookmark datatype mismatch error

查看:75
本文介绍了书签数据类型不匹配错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要确保我在DAO记录集中的记录与我刚才的记录不同




代码片段:


1. strFind =" thisSource =" &安培; tripID& " AND thisTrip = &安培; tripID

2. rs.FindFirst(strFind)

3.如果不是rs.NoMatch那么

4. strBookmark = rs.Bookmark

5. rs.MoveFirst

6.如果rs.Bookmark = strBookmark则rs.MoveNext

7. ...等等

因为类型不匹配而无法编译,在第6行突出显示相同的

符号;不在第4行。


我将我的书签变量强制转换为字符串,long,variant,与

相同。我可以用另一种方式做到这一点,但我想知道

为什么它不是这样工作,首先。 -tc

I need to make sure that I am on a different record than I just was
on, in a DAO recordset.

code fragment:

1. strFind = "thisSource = " & tripID & " AND thisTrip = " & tripID
2. rs.FindFirst (strFind)
3. If Not rs.NoMatch Then
4. strBookmark = rs.Bookmark
5. rs.MoveFirst
6. If rs.Bookmark = strBookmark Then rs.MoveNext
7. ...and so on

it wont compile because of a type mismatch, highlighting the equal
sign on line 6; not on line 4.

I have cast my bookmark variable as string, long, variant, with the
same result. I can probably do this another way, but I want to know
why it isn''t working this way, first. -tc

推荐答案

从内存中,书签是区分大小写的变体。


试试声明:

Dim varBookmark As Variant


然后在第4行:

varBookmark = rs.Bookmark


然后在第6行:

如果StrComp(rs.Bookmark,varBookmark,vbBinaryCompare)= 0 ...


-

Allen Browne - 微软MVP。西澳大利亚珀斯

访问用户提示 - http:// allenbrowne .com / tips.html

回复群组,而不是mvps dot org的allenbrowne。


Tom Clavel < to ******* @ ouraynet.com写信息

新闻:11 ********************** @ e65g2000hsc.googlegr oups.com ...
From memory, bookmarks are case-sensitive variants.

Try declaring:
Dim varBookmark As Variant

Then at line 4:
varBookmark = rs.Bookmark

Then at line 6:
If StrComp(rs.Bookmark, varBookmark, vbBinaryCompare) = 0 ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tom Clavel" <to*******@ouraynet.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...

>我需要确保我的记录与我不同的记录

,在DAO记录集中。


代码片段:


1. strFind =" thisSource =" &安培; tripID& " AND thisTrip = &安培; tripID

2. rs.FindFirst(strFind)

3.如果不是rs.NoMatch那么

4. strBookmark = rs.Bookmark

5. rs.MoveFirst

6.如果rs.Bookmark = strBookmark则rs.MoveNext

7. ...等等

因为类型不匹配而无法编译,在第6行突出显示相同的

符号;不在第4行。


我将我的书签变量强制转换为字符串,long,variant,与

相同。我可以用另一种方式做到这一点,但我想知道

为什么它不是这样工作,首先。 -tc
>I need to make sure that I am on a different record than I just was
on, in a DAO recordset.

code fragment:

1. strFind = "thisSource = " & tripID & " AND thisTrip = " & tripID
2. rs.FindFirst (strFind)
3. If Not rs.NoMatch Then
4. strBookmark = rs.Bookmark
5. rs.MoveFirst
6. If rs.Bookmark = strBookmark Then rs.MoveNext
7. ...and so on

it wont compile because of a type mismatch, highlighting the equal
sign on line 6; not on line 4.

I have cast my bookmark variable as string, long, variant, with the
same result. I can probably do this another way, but I want to know
why it isn''t working this way, first. -tc


谢谢。它的工作正常。 -tc


4月22日晚上10点07分,Allen Browne < AllenBro ... @ SeeSig.Invalid>

写道:
Thanks. It works just right. -tc

On Apr 22, 10:07 pm, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:

从内存中,书签是区分大小写的变体。


尝试声明:

Dim varBookmark As Variant


然后在第4行:

varBookmark = rs.Bookmark


然后在第6行:

如果StrComp(rs.Bookmark,varBookmark,vbBinaryCompare)= 0 ...


-

Allen Browne - 微软MVP。西澳大利亚珀斯

访问用户提示-http://allenbrowne.com/tips.html

回复群组,而不是mvps dot org的allenbrowne。


" Tom Clavel" < tomcla ... @ ouraynet.com写了留言


新闻:11 ********************** @ e65g2000hsc.googlegr oups.com ...
From memory, bookmarks are case-sensitive variants.

Try declaring:
Dim varBookmark As Variant

Then at line 4:
varBookmark = rs.Bookmark

Then at line 6:
If StrComp(rs.Bookmark, varBookmark, vbBinaryCompare) = 0 ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tom Clavel" <tomcla...@ouraynet.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...

我需要确保我的记录不同于我的记录

on ,在DAO记录集中。
I need to make sure that I am on a different record than I just was
on, in a DAO recordset.


代码片段:
code fragment:


1. strFind =" thisSource = &安培; tripID& " AND thisTrip = &安培; tripID

2. rs.FindFirst(strFind)

3.如果不是rs.NoMatch那么

4. strBookmark = rs.Bookmark

5. rs.MoveFirst

6.如果rs.Bookmark = strBookmark那么rs.MoveNext

7. ...等等
1. strFind = "thisSource = " & tripID & " AND thisTrip = " & tripID
2. rs.FindFirst (strFind)
3. If Not rs.NoMatch Then
4. strBookmark = rs.Bookmark
5. rs.MoveFirst
6. If rs.Bookmark = strBookmark Then rs.MoveNext
7. ...and so on


由于类型不匹配而无法编译,在第6行突出显示相等的

符号;不在第4行。
it wont compile because of a type mismatch, highlighting the equal
sign on line 6; not on line 4.


我将我的书签变量转换为字符串,long,variant,与

相同的结果。我可以用另一种方式做到这一点,但我想知道

为什么它不是这样工作,首先。 -tc
I have cast my bookmark variable as string, long, variant, with the
same result. I can probably do this another way, but I want to know
why it isn''t working this way, first. -tc



Tom Clavel< to ******* @ ouraynet.comwrote in

news:11 ********************** @ e65g2000hsc.googlegr psps.com:
Tom Clavel <to*******@ouraynet.comwrote in
news:11**********************@e65g2000hsc.googlegr oups.com:

我需要确保我的记录不同于我在DAO记录集中打开的



代码片段:


1. strFind =" thisSource =" &安培; tripID& " AND thisTrip = &

tripID 2. rs.FindFirst(strFind)

3.如果不是rs.NoMatch那么

4. strBookmark = rs.Bookmark

5. rs.MoveFirst

6.如果rs.Bookmark = strBookmark那么rs.MoveNext

7. ...等等<由于类型不匹配,它不会编译,在第6行突出显示相等的

符号;不在第4行。


我将我的书签变量转换为字符串,长,变体,与

相同的结果。我可以用另一种方式做到这一点,但我想要知道为什么它不是这样工作的,首先是

I need to make sure that I am on a different record than I just
was on, in a DAO recordset.

code fragment:

1. strFind = "thisSource = " & tripID & " AND thisTrip = " &
tripID 2. rs.FindFirst (strFind)
3. If Not rs.NoMatch Then
4. strBookmark = rs.Bookmark
5. rs.MoveFirst
6. If rs.Bookmark = strBookmark Then rs.MoveNext
7. ...and so on

it wont compile because of a type mismatch, highlighting the equal
sign on line 6; not on line 4.

I have cast my bookmark variable as string, long, variant, with
the same result. I can probably do this another way, but I want
to know why it isn''t working this way, first.



为什么要存储书签?你是否要一次跟踪

多个书签?


你做的不是更有意义测试真正的价值

在记录中,而不是书签?


我从来没有在变量中存储过书签,所以不太好

看点。它的数据太不稳定而无法存储,

在我看来。


-

David W 。芬顿 http://www.dfenton.com/

usenet at dfenton dot com http://www.dfenton.com/DFA/


这篇关于书签数据类型不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆