G
Guest
I have written the following code (I am new at this so bear with me Please).
Basically I want to first Close the form "Bibliotheca" and then reopen it
showing the record that it was on before it closed. When I run it it tells me
"Mismatch", the field BookID is a number field so I can't understand why it
wont accept it.
I hope that someone can help me.
Private Sub Close_Edition_Number_Form_Click()
On Error GoTo Err_Close_Edition_Number_Form_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stMyName As String
Dim intBookNum As Integer
stMyName = "Edition"
stDocName = "Bibliotheca"
intBookNum = "Bibliotheca!BookID"
If Len("" & stMyName) < 1 Then
DoCmd.CancelEvent
Else
DoCmd.Save
DoCmd.Close acForm, stDocName
DoCmd.OpenForm stDocName, , , "BookID = intBookNum"
DoCmd.Close acForm, stMyName
End If
Exit_Close_Edition_Number_Form_Click:
Exit Sub
Err_Close_Edition_Number_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Edition_Number_Form_Click
End Sub
Steven.
Basically I want to first Close the form "Bibliotheca" and then reopen it
showing the record that it was on before it closed. When I run it it tells me
"Mismatch", the field BookID is a number field so I can't understand why it
wont accept it.
I hope that someone can help me.
Private Sub Close_Edition_Number_Form_Click()
On Error GoTo Err_Close_Edition_Number_Form_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stMyName As String
Dim intBookNum As Integer
stMyName = "Edition"
stDocName = "Bibliotheca"
intBookNum = "Bibliotheca!BookID"
If Len("" & stMyName) < 1 Then
DoCmd.CancelEvent
Else
DoCmd.Save
DoCmd.Close acForm, stDocName
DoCmd.OpenForm stDocName, , , "BookID = intBookNum"
DoCmd.Close acForm, stMyName
End If
Exit_Close_Edition_Number_Form_Click:
Exit Sub
Err_Close_Edition_Number_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Edition_Number_Form_Click
End Sub
Steven.