BleepingComputer.com: Visual Basic '97 to '07 Convertion?

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Visual Basic '97 to '07 Convertion? I am having an issue with some Visual Basic Coding I am updating.

#1 User is offline   Shamis25 

  • New Member
  • Pip
  • Find Topics
  • Group: Members
  • Posts: 1
  • Joined: 06-January 11

Posted 06 January 2011 - 10:33 AM

Here is my conundrum:

I am young aspiring program, and I have not yet begun to tackle Visual Basic. However I have been assigned the task of updating a Microsoft Access database from the 1997 version to 2007. The Access program is not foreign to me, but Visual Basic and C++ are; and the current database I am working with has an extensive amount of outdated VB code i have to fix.

So far my tactic has been to debug/compile the code and the try to troubleshoot the problems with only the highlighted problematic text, and the error that occurred. This method worked for a short amount of time, but I eventual got stumped on a particular error and now here I am.

So here is the current code I am having trouble with:

______________________________________________________________________________________________
Function NewRates()

Dim Db As Database, CFile As Table

Dim Temp3

Set Db = CurrentDb()

Set CFile = Db.OpenTable("Customers")
CFile.Index = "PrimaryKey"
CFile.MoveFirst

Do Until CFile.EOF 'Run through all Customer Records

Temp3 = 0
If CFile![Monthly Charge] = 9 Then
Temp3 = 3
End If

If CFile![Monthly Charge] = 11 Then
Temp3 = 6
End If

If CFile![Monthly Charge] = 30 Then
Temp3 = 15
End If

If CFile![Monthly Charge] = 32 Then
Temp3 = 13
End If

CFile.Edit
CFile![Monthly Charge] = CFile![Monthly Charge] + Temp3
CFile.Update

CFile.MoveNext

Loop

CFile.Close

NewRates = Null

End Function
______________________________________________________________________________________________

The error I am currently contending with is on the second line of code "Dim Db As Database, CFile As Table", where it is highlighting the ', CFile As Table' section and saying 'user defined type not defined' any help would be greatly appreciated.

This post has been edited by Shamis25: 06 January 2011 - 10:34 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users