Code won't run!

G

Guest

I have written a database App using Access XP and everything is working OK
except for one section where I have some code that will not run on machines
with Access 2000, but works fine with XP / 2003.

The code is executed by clicking a button on a form. All I get with 2000 is
the animation of the button being pressed, but nothing else happens.

The code is listed below:

MsgBox ("1")
'Define variable to hold field contents
Dim strManfID As String
Dim strclassification As String
Dim strTypeOfEquip As String
Dim strRangeModel As String
Dim strmanufacturer As String
Dim strDepartment As String
Dim strLocation As String
Dim intDrawerNumber As Integer
Dim strStatus As String
Dim strUsedOn As String
Dim dblNOT As Double
Dim dblPitch As Double
Dim dblPA As Double
Dim strScrewText As String
Dim dblScrewSize As Double
Dim strOrderNumber As String
Dim dteDateOrdered As Variant
Dim dteDateDue As Variant
Dim curPrice As Variant
Dim strDrgNo As String
Dim dteLastCal As Variant
Dim dteCalDue As Variant
Dim strCalFreq As String
Dim dteBackFromCal As String
Dim strCalOrderNo As String
Dim curCalCost As Variant
Dim dblCalsPerYear As Double
Dim strComments As String
Dim intGaugeNo As Integer
Dim strProject As String

MsgBox ("2")
'Transfer Field contents to variables
strManfID = Nz(Form.[Ser No], " ")
strclassification = Nz(Form.[Type of Equipment], " ")
strTypeOfEquip = Nz(Form.TypeOfequipmentSub, " ")
strRangeModel = Nz(Form.[Range / Model], " ")
strmanufacturer = Nz(Form.Text33, " ")
strDepartment = Nz(Form.Combo39, " ")
strLocation = Nz(Form.Text36, " ")
intDrawerNumber = Nz(Form.Text53, "0")
strStatus = Nz(Form.Status, " ")
strUsedOn = Nz(Form.Text85, " ")
dblNOT = Nz(Form.Text77, "0")
dblPitch = Nz(Form.Text79, "0")
dblPA = Nz(Form.Text81, "0")
strScrewText = Nz(Form.Text43, " ")
dblScrewSize = Nz(Form.Size, "0")
strOrderNumber = Nz(Form.Text61, " ")
dteDateOrdered = Nz(Form.Text63, "")
dteDateDue = Nz(Form.Text65, "")
curPrice = Nz(Form.Text67, "")
strDrgNo = Nz(Form.Text212, " ")
dteLastCal = Nz(Form.[Cal Date], "")
dteCalDue = Nz(Form.[Cal Due], "")
strCalFreq = Nz(Form.[Calibration Freq], " ")
dteBackFromCal = Nz(Form.Text45, " ")
strCalOrderNo = Nz(Form.Laboratory, " ")
curCalCost = Nz(Form.[Cal cost], "")
dblCalsPerYear = Nz(Form.[Cals per year], "0")
strComments = Nz(Form.Comments, " ")
strProject = Nz(Form.Text217, " ")

MsgBox ("3")
'Open recordset
Dim rsCurr As DAO.Recordset
Set rsCurr = CurrentDb().OpenRecordset("Select * from
GaugeCalibrationRecords")

'Get last gauge number and add 1
intGaugeNo = DMax("[GaugeNo]", "[GaugeCalibrationRecords]") + 1

'Transfer fields into table
With rsCurr
.AddNew
!SerNo = strManfID
!TypeOfEquipment = strclassification
!TypeOfequipmentSub = strTypeOfEquip
!RangeOrModel = strRangeModel
!Manufacturer = strmanufacturer
!Department = strDepartment
!Location = strLocation
!DrawerNumber = intDrawerNumber
!Status = strStatus
!UsedOn = strUsedOn
!NoOfTeeth = dblNOT
!Pitch = dblPitch
!PressureAngle = dblPA
!SizeText = strScrewText
!ThSize = dblScrewSize
!OrderNumber = strOrderNumber
If dteDateOrdered <> "" Then
!DateOrdered = dteDateOrdered
End If
If dteDateDue <> "" Then
!DateDue = dteDateDue
End If
If curPrice <> "" Then
!Price = curPrice
End If
!SupplierDrgNo = strDrgNo
If dteLastCal <> "" Then
!CalDate = dteLastCal
End If
If dteCalDue <> "" Then
!CalDue = dteCalDue
End If
!CalibrationFreq = strCalFreq
If curCalCost <> "" Then
!CalCost = curCalCost
End If
!CalsPerYear = dblCalsPerYear
!Comments = strComments
!GaugeNo = intGaugeNo
!InitialPC = strProject
.Update
End With

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
Chr(13) & "Please check the Intranet listing for this gauge")
DoCmd.Close
End Sub

The Message Box commands are jsut my crude attempts at checking what's going
on, but I don't even see the first one so I can only deduce that the code
isn't being fired at all.

The database is saved as 2000 file format, and other code within the app
works fine.

Anybody seen anything like this before?

Thanks in advance

Neil
 
R

ruralguy via AccessMonster.com

Can you set a breakpoint and single step the code to see what is going on?
I have written a database App using Access XP and everything is working OK
except for one section where I have some code that will not run on machines
with Access 2000, but works fine with XP / 2003.

The code is executed by clicking a button on a form. All I get with 2000 is
the animation of the button being pressed, but nothing else happens.

The code is listed below:

MsgBox ("1")
'Define variable to hold field contents
Dim strManfID As String
Dim strclassification As String
Dim strTypeOfEquip As String
Dim strRangeModel As String
Dim strmanufacturer As String
Dim strDepartment As String
Dim strLocation As String
Dim intDrawerNumber As Integer
Dim strStatus As String
Dim strUsedOn As String
Dim dblNOT As Double
Dim dblPitch As Double
Dim dblPA As Double
Dim strScrewText As String
Dim dblScrewSize As Double
Dim strOrderNumber As String
Dim dteDateOrdered As Variant
Dim dteDateDue As Variant
Dim curPrice As Variant
Dim strDrgNo As String
Dim dteLastCal As Variant
Dim dteCalDue As Variant
Dim strCalFreq As String
Dim dteBackFromCal As String
Dim strCalOrderNo As String
Dim curCalCost As Variant
Dim dblCalsPerYear As Double
Dim strComments As String
Dim intGaugeNo As Integer
Dim strProject As String

MsgBox ("2")
'Transfer Field contents to variables
strManfID = Nz(Form.[Ser No], " ")
strclassification = Nz(Form.[Type of Equipment], " ")
strTypeOfEquip = Nz(Form.TypeOfequipmentSub, " ")
strRangeModel = Nz(Form.[Range / Model], " ")
strmanufacturer = Nz(Form.Text33, " ")
strDepartment = Nz(Form.Combo39, " ")
strLocation = Nz(Form.Text36, " ")
intDrawerNumber = Nz(Form.Text53, "0")
strStatus = Nz(Form.Status, " ")
strUsedOn = Nz(Form.Text85, " ")
dblNOT = Nz(Form.Text77, "0")
dblPitch = Nz(Form.Text79, "0")
dblPA = Nz(Form.Text81, "0")
strScrewText = Nz(Form.Text43, " ")
dblScrewSize = Nz(Form.Size, "0")
strOrderNumber = Nz(Form.Text61, " ")
dteDateOrdered = Nz(Form.Text63, "")
dteDateDue = Nz(Form.Text65, "")
curPrice = Nz(Form.Text67, "")
strDrgNo = Nz(Form.Text212, " ")
dteLastCal = Nz(Form.[Cal Date], "")
dteCalDue = Nz(Form.[Cal Due], "")
strCalFreq = Nz(Form.[Calibration Freq], " ")
dteBackFromCal = Nz(Form.Text45, " ")
strCalOrderNo = Nz(Form.Laboratory, " ")
curCalCost = Nz(Form.[Cal cost], "")
dblCalsPerYear = Nz(Form.[Cals per year], "0")
strComments = Nz(Form.Comments, " ")
strProject = Nz(Form.Text217, " ")

MsgBox ("3")
'Open recordset
Dim rsCurr As DAO.Recordset
Set rsCurr = CurrentDb().OpenRecordset("Select * from
GaugeCalibrationRecords")

'Get last gauge number and add 1
intGaugeNo = DMax("[GaugeNo]", "[GaugeCalibrationRecords]") + 1

'Transfer fields into table
With rsCurr
.AddNew
!SerNo = strManfID
!TypeOfEquipment = strclassification
!TypeOfequipmentSub = strTypeOfEquip
!RangeOrModel = strRangeModel
!Manufacturer = strmanufacturer
!Department = strDepartment
!Location = strLocation
!DrawerNumber = intDrawerNumber
!Status = strStatus
!UsedOn = strUsedOn
!NoOfTeeth = dblNOT
!Pitch = dblPitch
!PressureAngle = dblPA
!SizeText = strScrewText
!ThSize = dblScrewSize
!OrderNumber = strOrderNumber
If dteDateOrdered <> "" Then
!DateOrdered = dteDateOrdered
End If
If dteDateDue <> "" Then
!DateDue = dteDateDue
End If
If curPrice <> "" Then
!Price = curPrice
End If
!SupplierDrgNo = strDrgNo
If dteLastCal <> "" Then
!CalDate = dteLastCal
End If
If dteCalDue <> "" Then
!CalDue = dteCalDue
End If
!CalibrationFreq = strCalFreq
If curCalCost <> "" Then
!CalCost = curCalCost
End If
!CalsPerYear = dblCalsPerYear
!Comments = strComments
!GaugeNo = intGaugeNo
!InitialPC = strProject
.Update
End With

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
Chr(13) & "Please check the Intranet listing for this gauge")
DoCmd.Close
End Sub

The Message Box commands are jsut my crude attempts at checking what's going
on, but I don't even see the first one so I can only deduce that the code
isn't being fired at all.

The database is saved as 2000 file format, and other code within the app
works fine.

Anybody seen anything like this before?

Thanks in advance

Neil
 
G

Guest

Check your VBA references. 2000's default is ADO, but 2003 is DAO. Be sure
you have a referece to DAO.

Neil said:
I have written a database App using Access XP and everything is working OK
except for one section where I have some code that will not run on machines
with Access 2000, but works fine with XP / 2003.

The code is executed by clicking a button on a form. All I get with 2000 is
the animation of the button being pressed, but nothing else happens.

The code is listed below:

MsgBox ("1")
'Define variable to hold field contents
Dim strManfID As String
Dim strclassification As String
Dim strTypeOfEquip As String
Dim strRangeModel As String
Dim strmanufacturer As String
Dim strDepartment As String
Dim strLocation As String
Dim intDrawerNumber As Integer
Dim strStatus As String
Dim strUsedOn As String
Dim dblNOT As Double
Dim dblPitch As Double
Dim dblPA As Double
Dim strScrewText As String
Dim dblScrewSize As Double
Dim strOrderNumber As String
Dim dteDateOrdered As Variant
Dim dteDateDue As Variant
Dim curPrice As Variant
Dim strDrgNo As String
Dim dteLastCal As Variant
Dim dteCalDue As Variant
Dim strCalFreq As String
Dim dteBackFromCal As String
Dim strCalOrderNo As String
Dim curCalCost As Variant
Dim dblCalsPerYear As Double
Dim strComments As String
Dim intGaugeNo As Integer
Dim strProject As String

MsgBox ("2")
'Transfer Field contents to variables
strManfID = Nz(Form.[Ser No], " ")
strclassification = Nz(Form.[Type of Equipment], " ")
strTypeOfEquip = Nz(Form.TypeOfequipmentSub, " ")
strRangeModel = Nz(Form.[Range / Model], " ")
strmanufacturer = Nz(Form.Text33, " ")
strDepartment = Nz(Form.Combo39, " ")
strLocation = Nz(Form.Text36, " ")
intDrawerNumber = Nz(Form.Text53, "0")
strStatus = Nz(Form.Status, " ")
strUsedOn = Nz(Form.Text85, " ")
dblNOT = Nz(Form.Text77, "0")
dblPitch = Nz(Form.Text79, "0")
dblPA = Nz(Form.Text81, "0")
strScrewText = Nz(Form.Text43, " ")
dblScrewSize = Nz(Form.Size, "0")
strOrderNumber = Nz(Form.Text61, " ")
dteDateOrdered = Nz(Form.Text63, "")
dteDateDue = Nz(Form.Text65, "")
curPrice = Nz(Form.Text67, "")
strDrgNo = Nz(Form.Text212, " ")
dteLastCal = Nz(Form.[Cal Date], "")
dteCalDue = Nz(Form.[Cal Due], "")
strCalFreq = Nz(Form.[Calibration Freq], " ")
dteBackFromCal = Nz(Form.Text45, " ")
strCalOrderNo = Nz(Form.Laboratory, " ")
curCalCost = Nz(Form.[Cal cost], "")
dblCalsPerYear = Nz(Form.[Cals per year], "0")
strComments = Nz(Form.Comments, " ")
strProject = Nz(Form.Text217, " ")

MsgBox ("3")
'Open recordset
Dim rsCurr As DAO.Recordset
Set rsCurr = CurrentDb().OpenRecordset("Select * from
GaugeCalibrationRecords")

'Get last gauge number and add 1
intGaugeNo = DMax("[GaugeNo]", "[GaugeCalibrationRecords]") + 1

'Transfer fields into table
With rsCurr
.AddNew
!SerNo = strManfID
!TypeOfEquipment = strclassification
!TypeOfequipmentSub = strTypeOfEquip
!RangeOrModel = strRangeModel
!Manufacturer = strmanufacturer
!Department = strDepartment
!Location = strLocation
!DrawerNumber = intDrawerNumber
!Status = strStatus
!UsedOn = strUsedOn
!NoOfTeeth = dblNOT
!Pitch = dblPitch
!PressureAngle = dblPA
!SizeText = strScrewText
!ThSize = dblScrewSize
!OrderNumber = strOrderNumber
If dteDateOrdered <> "" Then
!DateOrdered = dteDateOrdered
End If
If dteDateDue <> "" Then
!DateDue = dteDateDue
End If
If curPrice <> "" Then
!Price = curPrice
End If
!SupplierDrgNo = strDrgNo
If dteLastCal <> "" Then
!CalDate = dteLastCal
End If
If dteCalDue <> "" Then
!CalDue = dteCalDue
End If
!CalibrationFreq = strCalFreq
If curCalCost <> "" Then
!CalCost = curCalCost
End If
!CalsPerYear = dblCalsPerYear
!Comments = strComments
!GaugeNo = intGaugeNo
!InitialPC = strProject
.Update
End With

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
Chr(13) & "Please check the Intranet listing for this gauge")
DoCmd.Close
End Sub

The Message Box commands are jsut my crude attempts at checking what's going
on, but I don't even see the first one so I can only deduce that the code
isn't being fired at all.

The database is saved as 2000 file format, and other code within the app
works fine.

Anybody seen anything like this before?

Thanks in advance

Neil
 
G

Guest

Thanks for your suggestions guys, I sorted it out - The little fudge I'd used
near the end to create a two line message box doesn't seem to work in 2000.

Thanks

Neil

Neil said:
I have written a database App using Access XP and everything is working OK
except for one section where I have some code that will not run on machines
with Access 2000, but works fine with XP / 2003.

The code is executed by clicking a button on a form. All I get with 2000 is
the animation of the button being pressed, but nothing else happens.

The code is listed below:

MsgBox ("1")
'Define variable to hold field contents
Dim strManfID As String
Dim strclassification As String
Dim strTypeOfEquip As String
Dim strRangeModel As String
Dim strmanufacturer As String
Dim strDepartment As String
Dim strLocation As String
Dim intDrawerNumber As Integer
Dim strStatus As String
Dim strUsedOn As String
Dim dblNOT As Double
Dim dblPitch As Double
Dim dblPA As Double
Dim strScrewText As String
Dim dblScrewSize As Double
Dim strOrderNumber As String
Dim dteDateOrdered As Variant
Dim dteDateDue As Variant
Dim curPrice As Variant
Dim strDrgNo As String
Dim dteLastCal As Variant
Dim dteCalDue As Variant
Dim strCalFreq As String
Dim dteBackFromCal As String
Dim strCalOrderNo As String
Dim curCalCost As Variant
Dim dblCalsPerYear As Double
Dim strComments As String
Dim intGaugeNo As Integer
Dim strProject As String

MsgBox ("2")
'Transfer Field contents to variables
strManfID = Nz(Form.[Ser No], " ")
strclassification = Nz(Form.[Type of Equipment], " ")
strTypeOfEquip = Nz(Form.TypeOfequipmentSub, " ")
strRangeModel = Nz(Form.[Range / Model], " ")
strmanufacturer = Nz(Form.Text33, " ")
strDepartment = Nz(Form.Combo39, " ")
strLocation = Nz(Form.Text36, " ")
intDrawerNumber = Nz(Form.Text53, "0")
strStatus = Nz(Form.Status, " ")
strUsedOn = Nz(Form.Text85, " ")
dblNOT = Nz(Form.Text77, "0")
dblPitch = Nz(Form.Text79, "0")
dblPA = Nz(Form.Text81, "0")
strScrewText = Nz(Form.Text43, " ")
dblScrewSize = Nz(Form.Size, "0")
strOrderNumber = Nz(Form.Text61, " ")
dteDateOrdered = Nz(Form.Text63, "")
dteDateDue = Nz(Form.Text65, "")
curPrice = Nz(Form.Text67, "")
strDrgNo = Nz(Form.Text212, " ")
dteLastCal = Nz(Form.[Cal Date], "")
dteCalDue = Nz(Form.[Cal Due], "")
strCalFreq = Nz(Form.[Calibration Freq], " ")
dteBackFromCal = Nz(Form.Text45, " ")
strCalOrderNo = Nz(Form.Laboratory, " ")
curCalCost = Nz(Form.[Cal cost], "")
dblCalsPerYear = Nz(Form.[Cals per year], "0")
strComments = Nz(Form.Comments, " ")
strProject = Nz(Form.Text217, " ")

MsgBox ("3")
'Open recordset
Dim rsCurr As DAO.Recordset
Set rsCurr = CurrentDb().OpenRecordset("Select * from
GaugeCalibrationRecords")

'Get last gauge number and add 1
intGaugeNo = DMax("[GaugeNo]", "[GaugeCalibrationRecords]") + 1

'Transfer fields into table
With rsCurr
.AddNew
!SerNo = strManfID
!TypeOfEquipment = strclassification
!TypeOfequipmentSub = strTypeOfEquip
!RangeOrModel = strRangeModel
!Manufacturer = strmanufacturer
!Department = strDepartment
!Location = strLocation
!DrawerNumber = intDrawerNumber
!Status = strStatus
!UsedOn = strUsedOn
!NoOfTeeth = dblNOT
!Pitch = dblPitch
!PressureAngle = dblPA
!SizeText = strScrewText
!ThSize = dblScrewSize
!OrderNumber = strOrderNumber
If dteDateOrdered <> "" Then
!DateOrdered = dteDateOrdered
End If
If dteDateDue <> "" Then
!DateDue = dteDateDue
End If
If curPrice <> "" Then
!Price = curPrice
End If
!SupplierDrgNo = strDrgNo
If dteLastCal <> "" Then
!CalDate = dteLastCal
End If
If dteCalDue <> "" Then
!CalDue = dteCalDue
End If
!CalibrationFreq = strCalFreq
If curCalCost <> "" Then
!CalCost = curCalCost
End If
!CalsPerYear = dblCalsPerYear
!Comments = strComments
!GaugeNo = intGaugeNo
!InitialPC = strProject
.Update
End With

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
Chr(13) & "Please check the Intranet listing for this gauge")
DoCmd.Close
End Sub

The Message Box commands are jsut my crude attempts at checking what's going
on, but I don't even see the first one so I can only deduce that the code
isn't being fired at all.

The database is saved as 2000 file format, and other code within the app
works fine.

Anybody seen anything like this before?

Thanks in advance

Neil
 
D

Douglas J. Steele

If you don't care what value's returned by the message box (i.e.: which
button the user clicked on), get rid of the parentheses.

If that still doesn't work, replace Chr(13) with either vbCrLf or Chr(13) &
Chr(10).


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Neil said:
Thanks for your suggestions guys, I sorted it out - The little fudge I'd
used
near the end to create a two line message box doesn't seem to work in
2000.

Thanks

Neil

Neil said:
I have written a database App using Access XP and everything is working
OK
except for one section where I have some code that will not run on
machines
with Access 2000, but works fine with XP / 2003.

The code is executed by clicking a button on a form. All I get with 2000
is
the animation of the button being pressed, but nothing else happens.

The code is listed below:

MsgBox ("1")
'Define variable to hold field contents
Dim strManfID As String
Dim strclassification As String
Dim strTypeOfEquip As String
Dim strRangeModel As String
Dim strmanufacturer As String
Dim strDepartment As String
Dim strLocation As String
Dim intDrawerNumber As Integer
Dim strStatus As String
Dim strUsedOn As String
Dim dblNOT As Double
Dim dblPitch As Double
Dim dblPA As Double
Dim strScrewText As String
Dim dblScrewSize As Double
Dim strOrderNumber As String
Dim dteDateOrdered As Variant
Dim dteDateDue As Variant
Dim curPrice As Variant
Dim strDrgNo As String
Dim dteLastCal As Variant
Dim dteCalDue As Variant
Dim strCalFreq As String
Dim dteBackFromCal As String
Dim strCalOrderNo As String
Dim curCalCost As Variant
Dim dblCalsPerYear As Double
Dim strComments As String
Dim intGaugeNo As Integer
Dim strProject As String

MsgBox ("2")
'Transfer Field contents to variables
strManfID = Nz(Form.[Ser No], " ")
strclassification = Nz(Form.[Type of Equipment], " ")
strTypeOfEquip = Nz(Form.TypeOfequipmentSub, " ")
strRangeModel = Nz(Form.[Range / Model], " ")
strmanufacturer = Nz(Form.Text33, " ")
strDepartment = Nz(Form.Combo39, " ")
strLocation = Nz(Form.Text36, " ")
intDrawerNumber = Nz(Form.Text53, "0")
strStatus = Nz(Form.Status, " ")
strUsedOn = Nz(Form.Text85, " ")
dblNOT = Nz(Form.Text77, "0")
dblPitch = Nz(Form.Text79, "0")
dblPA = Nz(Form.Text81, "0")
strScrewText = Nz(Form.Text43, " ")
dblScrewSize = Nz(Form.Size, "0")
strOrderNumber = Nz(Form.Text61, " ")
dteDateOrdered = Nz(Form.Text63, "")
dteDateDue = Nz(Form.Text65, "")
curPrice = Nz(Form.Text67, "")
strDrgNo = Nz(Form.Text212, " ")
dteLastCal = Nz(Form.[Cal Date], "")
dteCalDue = Nz(Form.[Cal Due], "")
strCalFreq = Nz(Form.[Calibration Freq], " ")
dteBackFromCal = Nz(Form.Text45, " ")
strCalOrderNo = Nz(Form.Laboratory, " ")
curCalCost = Nz(Form.[Cal cost], "")
dblCalsPerYear = Nz(Form.[Cals per year], "0")
strComments = Nz(Form.Comments, " ")
strProject = Nz(Form.Text217, " ")

MsgBox ("3")
'Open recordset
Dim rsCurr As DAO.Recordset
Set rsCurr = CurrentDb().OpenRecordset("Select * from
GaugeCalibrationRecords")

'Get last gauge number and add 1
intGaugeNo = DMax("[GaugeNo]", "[GaugeCalibrationRecords]") + 1

'Transfer fields into table
With rsCurr
.AddNew
!SerNo = strManfID
!TypeOfEquipment = strclassification
!TypeOfequipmentSub = strTypeOfEquip
!RangeOrModel = strRangeModel
!Manufacturer = strmanufacturer
!Department = strDepartment
!Location = strLocation
!DrawerNumber = intDrawerNumber
!Status = strStatus
!UsedOn = strUsedOn
!NoOfTeeth = dblNOT
!Pitch = dblPitch
!PressureAngle = dblPA
!SizeText = strScrewText
!ThSize = dblScrewSize
!OrderNumber = strOrderNumber
If dteDateOrdered <> "" Then
!DateOrdered = dteDateOrdered
End If
If dteDateDue <> "" Then
!DateDue = dteDateDue
End If
If curPrice <> "" Then
!Price = curPrice
End If
!SupplierDrgNo = strDrgNo
If dteLastCal <> "" Then
!CalDate = dteLastCal
End If
If dteCalDue <> "" Then
!CalDue = dteCalDue
End If
!CalibrationFreq = strCalFreq
If curCalCost <> "" Then
!CalCost = curCalCost
End If
!CalsPerYear = dblCalsPerYear
!Comments = strComments
!GaugeNo = intGaugeNo
!InitialPC = strProject
.Update
End With

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item"
&
Chr(13) & "Please check the Intranet listing for this gauge")
DoCmd.Close
End Sub

The Message Box commands are jsut my crude attempts at checking what's
going
on, but I don't even see the first one so I can only deduce that the code
isn't being fired at all.

The database is saved as 2000 file format, and other code within the app
works fine.

Anybody seen anything like this before?

Thanks in advance

Neil
 
G

Guest

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
Chr(13) & "Please check the Intranet listing for this gauge")

Try it like this
MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
vbCrLf & "Please check the Intranet listing for this gauge")

Neil said:
Thanks for your suggestions guys, I sorted it out - The little fudge I'd used
near the end to create a two line message box doesn't seem to work in 2000.

Thanks

Neil

Neil said:
I have written a database App using Access XP and everything is working OK
except for one section where I have some code that will not run on machines
with Access 2000, but works fine with XP / 2003.

The code is executed by clicking a button on a form. All I get with 2000 is
the animation of the button being pressed, but nothing else happens.

The code is listed below:

MsgBox ("1")
'Define variable to hold field contents
Dim strManfID As String
Dim strclassification As String
Dim strTypeOfEquip As String
Dim strRangeModel As String
Dim strmanufacturer As String
Dim strDepartment As String
Dim strLocation As String
Dim intDrawerNumber As Integer
Dim strStatus As String
Dim strUsedOn As String
Dim dblNOT As Double
Dim dblPitch As Double
Dim dblPA As Double
Dim strScrewText As String
Dim dblScrewSize As Double
Dim strOrderNumber As String
Dim dteDateOrdered As Variant
Dim dteDateDue As Variant
Dim curPrice As Variant
Dim strDrgNo As String
Dim dteLastCal As Variant
Dim dteCalDue As Variant
Dim strCalFreq As String
Dim dteBackFromCal As String
Dim strCalOrderNo As String
Dim curCalCost As Variant
Dim dblCalsPerYear As Double
Dim strComments As String
Dim intGaugeNo As Integer
Dim strProject As String

MsgBox ("2")
'Transfer Field contents to variables
strManfID = Nz(Form.[Ser No], " ")
strclassification = Nz(Form.[Type of Equipment], " ")
strTypeOfEquip = Nz(Form.TypeOfequipmentSub, " ")
strRangeModel = Nz(Form.[Range / Model], " ")
strmanufacturer = Nz(Form.Text33, " ")
strDepartment = Nz(Form.Combo39, " ")
strLocation = Nz(Form.Text36, " ")
intDrawerNumber = Nz(Form.Text53, "0")
strStatus = Nz(Form.Status, " ")
strUsedOn = Nz(Form.Text85, " ")
dblNOT = Nz(Form.Text77, "0")
dblPitch = Nz(Form.Text79, "0")
dblPA = Nz(Form.Text81, "0")
strScrewText = Nz(Form.Text43, " ")
dblScrewSize = Nz(Form.Size, "0")
strOrderNumber = Nz(Form.Text61, " ")
dteDateOrdered = Nz(Form.Text63, "")
dteDateDue = Nz(Form.Text65, "")
curPrice = Nz(Form.Text67, "")
strDrgNo = Nz(Form.Text212, " ")
dteLastCal = Nz(Form.[Cal Date], "")
dteCalDue = Nz(Form.[Cal Due], "")
strCalFreq = Nz(Form.[Calibration Freq], " ")
dteBackFromCal = Nz(Form.Text45, " ")
strCalOrderNo = Nz(Form.Laboratory, " ")
curCalCost = Nz(Form.[Cal cost], "")
dblCalsPerYear = Nz(Form.[Cals per year], "0")
strComments = Nz(Form.Comments, " ")
strProject = Nz(Form.Text217, " ")

MsgBox ("3")
'Open recordset
Dim rsCurr As DAO.Recordset
Set rsCurr = CurrentDb().OpenRecordset("Select * from
GaugeCalibrationRecords")

'Get last gauge number and add 1
intGaugeNo = DMax("[GaugeNo]", "[GaugeCalibrationRecords]") + 1

'Transfer fields into table
With rsCurr
.AddNew
!SerNo = strManfID
!TypeOfEquipment = strclassification
!TypeOfequipmentSub = strTypeOfEquip
!RangeOrModel = strRangeModel
!Manufacturer = strmanufacturer
!Department = strDepartment
!Location = strLocation
!DrawerNumber = intDrawerNumber
!Status = strStatus
!UsedOn = strUsedOn
!NoOfTeeth = dblNOT
!Pitch = dblPitch
!PressureAngle = dblPA
!SizeText = strScrewText
!ThSize = dblScrewSize
!OrderNumber = strOrderNumber
If dteDateOrdered <> "" Then
!DateOrdered = dteDateOrdered
End If
If dteDateDue <> "" Then
!DateDue = dteDateDue
End If
If curPrice <> "" Then
!Price = curPrice
End If
!SupplierDrgNo = strDrgNo
If dteLastCal <> "" Then
!CalDate = dteLastCal
End If
If dteCalDue <> "" Then
!CalDue = dteCalDue
End If
!CalibrationFreq = strCalFreq
If curCalCost <> "" Then
!CalCost = curCalCost
End If
!CalsPerYear = dblCalsPerYear
!Comments = strComments
!GaugeNo = intGaugeNo
!InitialPC = strProject
.Update
End With

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
Chr(13) & "Please check the Intranet listing for this gauge")
DoCmd.Close
End Sub

The Message Box commands are jsut my crude attempts at checking what's going
on, but I don't even see the first one so I can only deduce that the code
isn't being fired at all.

The database is saved as 2000 file format, and other code within the app
works fine.

Anybody seen anything like this before?

Thanks in advance

Neil
 
R

ruralguy via AccessMonster.com

Thanks for posting back with your success Neil!
Thanks for your suggestions guys, I sorted it out - The little fudge I'd used
near the end to create a two line message box doesn't seem to work in 2000.

Thanks

Neil
I have written a database App using Access XP and everything is working OK
except for one section where I have some code that will not run on machines
[quoted text clipped - 142 lines]
 
G

Guest

Hi Neil,

Yes, I have experienced a situation on many occasions where command buttons
on a switchboard created in either Access 2002 or 2003 are dead in the water
when one opens the same database in Access 2000 and clicks on them. The only
fix that I have found so far is to create a brand new database using Access
2000, import all objects, and set references / start-up options the same.
Even opening Access 2000 with the undocumented /decompile switch does not fix
the problem. It's a very annoying situation indeed. I usually learned about
it after sending my work to another user for testing, and that other user
only has Access 2000 available. These days, I make sure to ask which version
they are using. If they indicate Access 2000, then I fire up my Access 2000
and test first, before sending it to them.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

Neil said:
I have written a database App using Access XP and everything is working OK
except for one section where I have some code that will not run on machines
with Access 2000, but works fine with XP / 2003.

The code is executed by clicking a button on a form. All I get with 2000 is
the animation of the button being pressed, but nothing else happens.

The code is listed below:

MsgBox ("1")
'Define variable to hold field contents
Dim strManfID As String
Dim strclassification As String
Dim strTypeOfEquip As String
Dim strRangeModel As String
Dim strmanufacturer As String
Dim strDepartment As String
Dim strLocation As String
Dim intDrawerNumber As Integer
Dim strStatus As String
Dim strUsedOn As String
Dim dblNOT As Double
Dim dblPitch As Double
Dim dblPA As Double
Dim strScrewText As String
Dim dblScrewSize As Double
Dim strOrderNumber As String
Dim dteDateOrdered As Variant
Dim dteDateDue As Variant
Dim curPrice As Variant
Dim strDrgNo As String
Dim dteLastCal As Variant
Dim dteCalDue As Variant
Dim strCalFreq As String
Dim dteBackFromCal As String
Dim strCalOrderNo As String
Dim curCalCost As Variant
Dim dblCalsPerYear As Double
Dim strComments As String
Dim intGaugeNo As Integer
Dim strProject As String

MsgBox ("2")
'Transfer Field contents to variables
strManfID = Nz(Form.[Ser No], " ")
strclassification = Nz(Form.[Type of Equipment], " ")
strTypeOfEquip = Nz(Form.TypeOfequipmentSub, " ")
strRangeModel = Nz(Form.[Range / Model], " ")
strmanufacturer = Nz(Form.Text33, " ")
strDepartment = Nz(Form.Combo39, " ")
strLocation = Nz(Form.Text36, " ")
intDrawerNumber = Nz(Form.Text53, "0")
strStatus = Nz(Form.Status, " ")
strUsedOn = Nz(Form.Text85, " ")
dblNOT = Nz(Form.Text77, "0")
dblPitch = Nz(Form.Text79, "0")
dblPA = Nz(Form.Text81, "0")
strScrewText = Nz(Form.Text43, " ")
dblScrewSize = Nz(Form.Size, "0")
strOrderNumber = Nz(Form.Text61, " ")
dteDateOrdered = Nz(Form.Text63, "")
dteDateDue = Nz(Form.Text65, "")
curPrice = Nz(Form.Text67, "")
strDrgNo = Nz(Form.Text212, " ")
dteLastCal = Nz(Form.[Cal Date], "")
dteCalDue = Nz(Form.[Cal Due], "")
strCalFreq = Nz(Form.[Calibration Freq], " ")
dteBackFromCal = Nz(Form.Text45, " ")
strCalOrderNo = Nz(Form.Laboratory, " ")
curCalCost = Nz(Form.[Cal cost], "")
dblCalsPerYear = Nz(Form.[Cals per year], "0")
strComments = Nz(Form.Comments, " ")
strProject = Nz(Form.Text217, " ")

MsgBox ("3")
'Open recordset
Dim rsCurr As DAO.Recordset
Set rsCurr = CurrentDb().OpenRecordset("Select * from
GaugeCalibrationRecords")

'Get last gauge number and add 1
intGaugeNo = DMax("[GaugeNo]", "[GaugeCalibrationRecords]") + 1

'Transfer fields into table
With rsCurr
.AddNew
!SerNo = strManfID
!TypeOfEquipment = strclassification
!TypeOfequipmentSub = strTypeOfEquip
!RangeOrModel = strRangeModel
!Manufacturer = strmanufacturer
!Department = strDepartment
!Location = strLocation
!DrawerNumber = intDrawerNumber
!Status = strStatus
!UsedOn = strUsedOn
!NoOfTeeth = dblNOT
!Pitch = dblPitch
!PressureAngle = dblPA
!SizeText = strScrewText
!ThSize = dblScrewSize
!OrderNumber = strOrderNumber
If dteDateOrdered <> "" Then
!DateOrdered = dteDateOrdered
End If
If dteDateDue <> "" Then
!DateDue = dteDateDue
End If
If curPrice <> "" Then
!Price = curPrice
End If
!SupplierDrgNo = strDrgNo
If dteLastCal <> "" Then
!CalDate = dteLastCal
End If
If dteCalDue <> "" Then
!CalDue = dteCalDue
End If
!CalibrationFreq = strCalFreq
If curCalCost <> "" Then
!CalCost = curCalCost
End If
!CalsPerYear = dblCalsPerYear
!Comments = strComments
!GaugeNo = intGaugeNo
!InitialPC = strProject
.Update
End With

MsgBox ("Gauge Number " & intGaugeNo & " has been assigned to this item" &
Chr(13) & "Please check the Intranet listing for this gauge")
DoCmd.Close
End Sub

The Message Box commands are jsut my crude attempts at checking what's going
on, but I don't even see the first one so I can only deduce that the code
isn't being fired at all.

The database is saved as 2000 file format, and other code within the app
works fine.

Anybody seen anything like this before?

Thanks in advance

Neil
 
Top