Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Visual Basic '97 to '07 Convertion?


  • Please log in to reply
No replies to this topic

#1 Shamis25

Shamis25

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Local time:06:44 PM

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.

Edited by Shamis25, 06 January 2011 - 10:34 AM.


BC AdBot (Login to Remove)

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users