PC Review


Reply
Thread Tools Rate Thread

Access 2000-2007 conversion - VB failing?

 
 
Booleanboy
Guest
Posts: n/a
 
      25th Nov 2009
I have a relatively simple contact database written with MS Access 2000 and
works fine running under Win XP but in Access 2007 running under Windows 7 I
have some problems with one of the forms.

I use a Combo Box (Combo206) at the top of a form to choose the 'Name' field
from a table so that the record can be displayed in the form body. When run
under Access 2007 the list of 'Name' fields is displayed but the form does
not update with the contents of the related record. I've tried converting the
entire file to the new Access 2007 format but this didn't resolve the problem.

How can I fix this? I suspect the problem is with the VB code. Here's the
code which works under A2000:

Sub Combo206_AfterUpdate()
On Error GoTo Err_Combo206_AfterUpdate
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ID] = " & Me![Combo206]
Me.Bookmark = Me.RecordsetClone.Bookmark

Exit_Combo206_AfterUpdate:
Exit Sub

Err_Combo206_AfterUpdate:
MsgBox Err.Description
Resume Exit_Combo206_AfterUpdate
End Sub

Additionally the code that used to set focus to the Combo Box now doesn't:

Private Sub Form_Open(Cancel As Integer)
Combo206.SetFocus
End Sub
 
Reply With Quote
 
 
 
 
Booleanboy
Guest
Posts: n/a
 
      26th Nov 2009
Thanks for assisting me - it is much appreciated.

Forgive me, I really don't have much experience here but if I substitute
your code:

Sub Combo206_AfterUpdate()
Dim rs as DAO.Recordset
Set rs = Me.RecordsetClone
' Find the record that matches the control.
With rs
..FindFirst "[ID] = " & Me![Combo206] 'Assuming number datatype
if .EOF then
msgbox "No record matching FindFirst"
else
Me.Bookmark = .Bookmark
end if
End With
set rs = Nothing 'destroy
End Sub

for my original Sub Combo206_AfterUpdate() code it doesn't work here. Am I
doing this correctly?

Just to be clear, the [ID] field is a unique numeric which is the Primary
Key for the table. The value typed into or selected from a list in the
ComboBox is the text content of the [Name] field associated with [ID].

Thanks again.


"AccessVandal via AccessMonster.com" wrote:

> Typo:
>
> Sorry, recordsetclone does not work with nomatch.
>
> if rs.EOF then 'change it to rs.EOF
> msgbox "No record matching FindFirst"
> else
> Me.Bookmark = rs.Bookmark
> end if
>
> Booleanboy wrote:
> snip..
>
> Or like this.....
>
> Dim rs as DAO.Recordset
> Set rs = Me.RecordsetClone
> ' Find the record that matches the control.
> With rs
> .FindFirst "[ID] = " & Me![Combo206] 'Assuming number datatype
> if .EOF then
> msgbox "No record matching FindFirst"
> else
> Me.Bookmark = .Bookmark
> end if
> End With
> set rs = Nothing 'destroy
>
> --
> Please Rate the posting if helps you.
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...arted/200911/1
>
> .
>

 
Reply With Quote
 
Booleanboy
Guest
Posts: n/a
 
      2nd Dec 2009
Thanks - this was exactly the problem. In my defence, the default colour
scheme for
Access 2007 is so pale that the notification message wasn't very visible.

I knew a warning was displayed the first time an 'old' file was run, I
didn't appreciate that the file was subsequently locked out without
displaying the message. I've modified the Trust Centre settings now and
all seems to work OK.

Thanks again - I'd been puzzling over this for a couple of weeks!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
old import specs failing in Access 2007 Duane Microsoft Access External Data 1 3rd Jul 2008 08:33 PM
Conversion from Access 2000 to Access 2007 Tigerchat Microsoft Access 7 10th Jun 2008 03:41 AM
Access 2003 VB Code Export Query Failing with Access 2007 user PatK Microsoft Access Queries 3 4th Dec 2007 06:20 PM
Error 3033 / Conversion from Access 2003 to Access 2007 Roxana Microsoft Access Security 0 26th Nov 2007 05:55 PM
Access 2000 to SQL Server 2000 conversion for Boolean fields Dave - daking@berkshirelife.com Microsoft Access ADP SQL Server 2 13th Apr 2004 10:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 PM.