D
Douglas J Steele
What are the compile errors you're getting?
Roy Brandon said:User Defined Type Not Defined
Douglas J Steele said:What are the compile errors you're getting?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Roy Brandon said:I found some errors in the code [control names] and corrected in case
that
was part of the problem. But still get the same compile problem.
Private Sub DetParts_LostFocus()
On Error GoTo Err_DetParts_LostFocus
SendKeys "{ESC}"
'add new detail record like existing one
Dim strNewRecRoNum As String
Dim intNewRecEntryNum As Integer
Dim intNewRecItemNum As Integer
Dim db As Database
Set db = CurrentDb()
Dim rs As Recordset
Set rs = db.OpenRecordset("Select Top 1 * From OrderDetailTbl
Where OrderNumber = '" & Me!OrderNumber & "' And RepairNumber = " &
Me!RepairNumber & " Order By RepairPartCount Desc", dbOpenSnapshot)
db.Execute "Insert Into OrderDetailTbl (OrderNumber,
RepairNumber, RepairPartCount) Select '" & Me!OrderNumber & "' as Expr1,
" &
Me!RepairNumber + 1 & " as Expr2, " & rs!RepairPartCount & " as Expr3"
strNewRecRoNum = Me!OrderNumber
intNewRecEntryNum = Me!RepairNumber + 1
intNewRecItemNum = rs!RepairPartCount
Me.Requery
Me.RecordsetClone.FindFirst "OrderNumber = '" &
strNewRecRoNum &
"' And RepairNumber = " & intNewRecEntryNum & " And RepairPartCount = " &
intNewRecItemNum
If Me.RecordsetClone.NoMatch Then
MsgBox "Program error. Can't find new record. Contact
programmer."
GoTo Exit_DetParts_LostFocus
End If
Me.Bookmark = Me.RecordsetClone.Bookmark
Exit_DetParts_LostFocus:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_DetParts_LostFocus:
MsgBox Err.Description & ": " & Str(Err.Number)
Resume Exit_DetParts_LostFocus
End Sub
Douglas J Steele said:What are the compile errors you're getting?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Roy Brandon said:I found some errors in the code [control names] and corrected in case
that
was part of the problem. But still get the same compile problem.
Private Sub DetParts_LostFocus()
On Error GoTo Err_DetParts_LostFocus
SendKeys "{ESC}"
'add new detail record like existing one
Dim strNewRecRoNum As String
Dim intNewRecEntryNum As Integer
Dim intNewRecItemNum As Integer
Dim db As Database
Set db = CurrentDb()
Dim rs As Recordset
Set rs = db.OpenRecordset("Select Top 1 * From OrderDetailTbl
Where OrderNumber = '" & Me!OrderNumber & "' And RepairNumber = " &
Me!RepairNumber & " Order By RepairPartCount Desc", dbOpenSnapshot)
db.Execute "Insert Into OrderDetailTbl (OrderNumber,
RepairNumber, RepairPartCount) Select '" & Me!OrderNumber & "' as Expr1,
" &
Me!RepairNumber + 1 & " as Expr2, " & rs!RepairPartCount & " as Expr3"
strNewRecRoNum = Me!OrderNumber
intNewRecEntryNum = Me!RepairNumber + 1
intNewRecItemNum = rs!RepairPartCount
Me.Requery
Me.RecordsetClone.FindFirst "OrderNumber = '" &
strNewRecRoNum &
"' And RepairNumber = " & intNewRecEntryNum & " And RepairPartCount = " &
intNewRecItemNum
If Me.RecordsetClone.NoMatch Then
MsgBox "Program error. Can't find new record. Contact
programmer."
GoTo Exit_DetParts_LostFocus
End If
Me.Bookmark = Me.RecordsetClone.Bookmark
Exit_DetParts_LostFocus:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_DetParts_LostFocus:
MsgBox Err.Description & ": " & Str(Err.Number)
Resume Exit_DetParts_LostFocus
End Sub
Douglas J Steele said:That implies that you don't have a reference set to DAO.
Go into the VB Editor, select Tools | References from the menu, scroll
through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, select it (using the checkbox) then
click
on OK to close the dialog.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Roy Brandon said:User Defined Type Not Defined
Douglas J Steele said:What are the compile errors you're getting?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
I found some errors in the code [control names] and corrected in case
that
was part of the problem. But still get the same compile problem.
Private Sub DetParts_LostFocus()
On Error GoTo Err_DetParts_LostFocus
SendKeys "{ESC}"
'add new detail record like existing one
Dim strNewRecRoNum As String
Dim intNewRecEntryNum As Integer
Dim intNewRecItemNum As Integer
Dim db As Database
Set db = CurrentDb()
Dim rs As Recordset
Set rs = db.OpenRecordset("Select Top 1 * From OrderDetailTbl
Where OrderNumber = '" & Me!OrderNumber & "' And RepairNumber = " &
Me!RepairNumber & " Order By RepairPartCount Desc", dbOpenSnapshot)
db.Execute "Insert Into OrderDetailTbl (OrderNumber,
RepairNumber, RepairPartCount) Select '" & Me!OrderNumber & "' as Expr1,
"
&
Me!RepairNumber + 1 & " as Expr2, " & rs!RepairPartCount & " as Expr3"
strNewRecRoNum = Me!OrderNumber
intNewRecEntryNum = Me!RepairNumber + 1
intNewRecItemNum = rs!RepairPartCount
Me.Requery
Me.RecordsetClone.FindFirst "OrderNumber = '" &
strNewRecRoNum
&
"' And RepairNumber = " & intNewRecEntryNum & " And RepairPartCount =
" &
intNewRecItemNum
If Me.RecordsetClone.NoMatch Then
MsgBox "Program error. Can't find new record.
Contact
programmer."
GoTo Exit_DetParts_LostFocus
End If
Me.Bookmark = Me.RecordsetClone.Bookmark
Exit_DetParts_LostFocus:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_DetParts_LostFocus:
MsgBox Err.Description & ": " & Str(Err.Number)
Resume Exit_DetParts_LostFocus
End Sub
Douglas J Steele said:That implies that you don't have a reference set to DAO.
Go into the VB Editor, select Tools | References from the menu, scroll
through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, select it (using the checkbox) then
click
on OK to close the dialog.
That implies that you don't have a reference set to DAO.
Go into the VB Editor, select Tools | References from the menu, scroll
through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, select it (using the checkbox) then
click
on OK to close the dialog.