ClassicPhil
Registered User.
- Local time
- Today, 03:29
- Joined
- Dec 20, 2012
- Messages
- 10
Ok, I have beating my brain over this long enough. We have a database here that we use several different forms to track each piece of computer equipment that we test in our lab. I tried to copy one of the forms and rename it to match a new piece of equipment (I've done this on several occassions) and then edit the code, create a table, and a few other things to make it work.
I was nearly complete when I got this error. I know enough about VBA to get through most of the database stuff we have to do, but this is a bit too advanced for me. Below is the code relating to the error...I have highlighted the section that the debug operation highlighted with a Red Font...I copied the entire sub to give as much info as possible:
The form name that this code came from is "Honeywell Handheld Scanner". Any help on this subject would be great. Thank you, and please let me know if you need any more information
I was nearly complete when I got this error. I know enough about VBA to get through most of the database stuff we have to do, but this is a bit too advanced for me. Below is the code relating to the error...I have highlighted the section that the debug operation highlighted with a Red Font...I copied the entire sub to give as much info as possible:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim Change
Dim Update
If Forms![BoardMain]![UserName].Caption = "Phil" Then
User = "Philip Hinton"
End If
If Forms![BoardMain]![Answer] = "ViewReport" Then
DoCmd.GoToControl "[UnitSerial]"
If IsNull(Forms![BoardMain]![Serial]) Or Forms![BoardMain]![Serial] = "" Then
Change = MsgBox("You didn't input a Serial Number!@If you would like your Name and Today's Date entered on a new report press YES, otherwise if you're just browsing select NO.@", vbYesNo + vbQuestion)
If Change = vbYes Then
DoCmd.GoToRecord , , acNewRec
If Forms![BoardMain]![Model] = "CDROM Drive" Then
UnitModel = "XM-6401B"
DriveType = "CDROM DRIVES"
DriveTest = "Insert a Test CD into the Drive. Read the CD using the TAR Command (TAC4) or Open the CD Directory (PC). Run Diagnostics using XSTM (TAC4) or Burn-In Test (PC). Remove any CDs used for Testing."
TapeFormat = "CDROM Drive"
ElseIf Forms![BoardMain]![Model] = "DVDROM Drive" Then
UnitModel = "XM-6401B"
DriveType = "DVDROM DRIVES"
DriveTest = "Insert a Test CD into the Drive. Read the CD using the TAR Command (TAC4) or Open the CD Directory (PC). Run Diagnostics using XSTM (TAC4) or Burn-In Test (PC). Remove any CDs used for Testing."
TapeFormat = "DVDROM Drive"
ElseIf Forms![BoardMain]![Model] = "Hard Drive" Then
UnitModel = "RDX1000E"
UnitPart = "8631-RDX"
DriveType = "HARD DRIVE SYSTEM"
TapeFormat = "Hard Drive"
ElseIf Forms![BoardMain]![Model] = "Honeywell Handheld Scanner" Then
UnitModel = "H100"
UnitPart = "MXCB1B500G4001FIPS"
DriveType = "HARD DRIVE SYSTEM"
TapeFormat = "Honeywell Handheld Scanner, IMATION"
End If
Me![Print] = User
Me![Date] = Format(Now, "m/d/yyyy")
DoCmd.Maximize
DoCmd.GoToControl "[UnitSerial]"
Else
DoCmd.Maximize
DoCmd.GoToControl "[UnitSerial]"
End If
Else
[COLOR=red]DoCmd.FindRecord Forms![BoardMain]![Serial], acEntire, , acSearchAll, , acCurrent[/COLOR]
If Me![UnitSerial] = Forms![BoardMain]![Serial] Then
If User = Me![Print] Then
If Year(Now) = Year(Me![Date]) And Month(Now) = Month(Me![Date]) And Day(Now) = Day(Me![Date]) Then
Else
Update = MsgBox(Forms![BoardMain]![UserName].Caption & ", This Report was last updated on " & Me![Date] & ".@Would you like to update the form with the Current Date?@", vbYesNo + vbQuestion)
If Update = vbYes Then
Me![Date] = Format(Now, "m/d/yyyy")
Me![Visits] = Me![Visits] + 1
Else
End If
End If
Else
Update = MsgBox(Forms![BoardMain]![UserName].Caption & ", This Report was last updated by " & Me![Print] & " on " & Me![Date] & ".@Would you like to update the form with your Name and the Current Date?@", vbYesNo + vbQuestion)
If Update = vbYes Then
Me![Print] = User
Me![Date] = Format(Now, "m/d/yyyy")
Me![Visits] = Me![Visits] + 1
Else
End If
End If
Else
DoCmd.GoToRecord , , acNewRec
If Forms![BoardMain]![Model] = "CDROM Drive" Then
UnitModel = "XM-6401B"
DriveType = "CDROM DRIVES"
ElseIf Forms![BoardMain]![Model] = "DVDROM Drive" Then
UnitModel = "XM-6401B"
DriveType = "DVDROM DRIVES"
ElseIf Forms![BoardMain]![Model] = "Hard Drive" Then
UnitModel = "RDX1000E"
UnitPart = "8631-RDX"
DriveType = "HARD DRIVE SYSTEM"
ElseIf Forms![BoardMain]![Model] = "Honeywell Handheld Scanner" Then
UnitModel = "H100"
UnitPart = "MXCB1B500G4001FIPS"
DriveType = "HARD DRIVE SYSTEM"
End If
Me![UnitSerial] = Forms![BoardMain]![Serial]
Me![Print] = User
Me![Date] = Format(Now, "m/d/yyyy")
DoCmd.Maximize
DoCmd.GoToControl "[UnitSerial]"
End If
End If
ElseIf Forms![BoardMain]![Answer] = "ChangeModel" Then
DoCmd.GoToControl "[UnitSerial]"
DoCmd.FindRecord "Blank Report", acEntire, , acSearchAll, , acCurrent
If UnitSerial = "Blank Report" Then
Else
DoCmd.GoToRecord , , acNewRec
UnitSerial = "Blank Report"
End If
End If
End Sub
The form name that this code came from is "Honeywell Handheld Scanner". Any help on this subject would be great. Thank you, and please let me know if you need any more information
Last edited: