|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Bug in MS Access Code
I had a Microsoft Access 2000 form. When I clicked on the button
with the code below it gives me an error "compile error: user-defined type not defined" It highlighted the error on the code Dim Dbs As Database ============================= Code:
Option Compare Database
Option Explicit
Private Sub Command1_Click()
Dim Dbs As Database
Set Dbs = CurrentDb
Dim Tenant_Number_Temp As String
Dim Unit_Number_Temp As String
Dim Last_Name_Temp As String
Dim First_Name_Temp As String
Dim counter As Long
Tenant_Number_Temp = "T-100-11-2-1999"
Unit_Number_Temp = "1000"
Last_Name_Temp = "Sacramento"
First_Name_Temp = "Jayson and John"
counter = 0
Do While counter < 10
counter = counter + 1
Text_10.SetFocus
Text_10.Text = counter
Dbs.Execute " INSERT INTO Customer " _
& "(Tenant_Number, Unit_Number, Last_Name, Fist_Name) VALUES" _
& "('" & Tenant_Number_Temp & "','" & Unit_Number_Temp & "','" & Last_Name_Temp & "','" & First_Name_Temp & "');"
Loop
MsgBox "The loop made " & counter & " repetitions."
End Sub
|
|
#2
|
|||
|
|||
|
Hi linh!U declare the CurrentDb type??I can't find in your code.
|
|
#3
|
|||
|
|||
|
I think you need to add a reference to the DAO library in Access 2000 to use DAO in code.
|
|
#4
|
|||
|
|||
|
reply
Hi Doug G. You are correct. Thank you for helping me.
Thank you everyone for participating. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Bug in MS Access Code |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|