Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2003, 02:53 PM
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default manipulating data in DAO

Hi friends,
I am a new person for Access VBA. I am testing a code an d got error message as
run-time error '13'
type mismatch

this is a simple code as

Private Sub testing_Click()
Dim db As Database, rec As Recordset
Dim aa As Integer
Set db = CurrentDb
Set rec = db.OpenRecordset("test", dbOpenTable)
aa = 0
Do
aa = aa + 1
Debug.Print rec![Name]
Loop Until aa > 2
End Sub

when i debuging it, it indicate error at line Set rec = db.OpenRecordset("test", dbOpenTable)

what is wrong?
Thanks for any help


Jimmy ([email protected])

 
Old November 14th, 2003, 07:05 PM
Authorized User
 
Join Date: Oct 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jimmy

I had to change the table [ZipCodeDetails] and field name
[CityName] for my mdb and recordset [rstZip],
but this now works for me

Dave

-------------------------
Option Compare Database
Option Explicit

Private Sub testing_Click()

Dim Cnn1 As ADODB.Connection
Set Cnn1 = CurrentProject.Connection
Dim rstZip As ADODB.Recordset
Dim Aa As Integer

Set rstZip = New ADODB.Recordset
rstZip.CursorType = adOpenKeyset
rstZip.LockType = adLockOptimistic
rstZip.Open "ZipCodeDetails", Cnn1, , , adCmdTable


Aa = 0
Do
Aa = Aa + 1
Debug.Print rstZip![CityName]
Loop Until Aa > 2
End Sub


 
Old November 19th, 2003, 10:55 AM
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi pmmgpgp,

Thanks for your help.
works!

Jimmy






Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating Data with Expressions baaul Reporting Services 2 June 22nd, 2006 10:14 AM
Manipulating data in access tables using VBA jass1317 Access VBA 1 January 25th, 2006 05:32 PM
Manipulating Data Problem - - - - Please Help! sendoh11 ASP.NET 1.0 and 1.1 Professional 1 June 29th, 2005 02:40 AM
Manipulating the data in db dungey PHP Databases 4 January 6th, 2005 11:31 AM
Manipulating data in ASP sri2004 Classic ASP Databases 0 June 17th, 2003 07:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.