Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Msg 'No Current Record'

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I have a database that when opened, a form called Client automatically is maximized on the user's screen. However, when you go to exit this form (click on the x in the top right corner) you get the error message 'No Current Record'. It doesn't matter how long you've been on this form, if you've made any changes, or even saved anything, you still get the error message without fail...

Any ideas?

Thanks in advance,
Ryan.
 
What do you mean by 'post the code behind the form'? I'm not that experienced with Access so please forgive my ignorance :)
 
Go into design mode of the form. Right click somewhere on the form and a properties box will come up. Click on the events tab. If, in any of the boxes, it says [Event Procedure], click on the ellipse (...) and Access will take you into the code window. Highlight evrything tere, cut it and paste here.

Also, while you're there, check the data tab. Make sure you click where the two "rulers" meet to get the form properties as opposed to one of the controls or the form detail. If the form is not displaying records (a switchboard, or menu) it should be empty. Tyrone Lumley
augerinn@gte.net
 
There are event procedures for:
-on current
-after update
-on dirty
-on delete
-before del confirm
-on close
-on keydown

The event procedure for 'on close' is as follows (this is probably where the error is occuring):

Private Sub Form_Close()
'UpdateRecentSearches
If Not IsUser("Management") Then
Application.Quit acQuitSaveAll
End If

End Sub
 
Function IsUser(strGroup As String) As Boolean
' Purpose: Determines if the current user belongs to the specified
' group.
' Accepts: The name of a group.
' Returns: True if the current user is a member of the specified
' group, False if the current user is not a member of
' the group.
' Assumes: The existence of a user called Developer in the Admins
' group, with no password.
'****************************************************************

On Error GoTo err_CurrentUserInGroup

Dim MyWorkSpace As Workspace
Dim MyGroup As Group, usUser As User

' Create a new workspace as a member of the Admins group.
Set MyWorkSpace = DBEngine.CreateWorkspace("SPECIAL", "Testadmin", "")

Set MyGroup = MyWorkSpace.Groups(strGroup)
For Each usUser In MyGroup.Users
If usUser.Name = CurrentUser Then
IsUser = True
End If
Next usUser

MyWorkSpace.Close
Exit Function

err_CurrentUserInGroup:
MsgBox Error(Err)

Exit Function

End Function
 
ACTUALLY...it has nothing to do with the onclose event procedure...I just deleted the entire code and tried to close the form (without any procedure) and I still got the error message...

Any ideas what else it could be?
 
I figured out what the problem is but don't know how to fix it.

I have a main form containing 5 tabs. One of these tabs is labelled 'Notes' and whenever the current client, who is showing on the form, has nothing entered under this tab I get the error message if I close the form while s/he is being displayed. However, if a client is being displayed who has stuff entered under the 'Notes' tab then when I close the form I do not get the error message.

Weird eh? But it's even weirder. If I simply tab through the records using the record selectors and come to a record with no info under the 'Notes' tab and try to close the form then I get the error message. However, if I do a search and bring up this same record and close the form I don't get any message...

I don't really understand this...Can you help think of any type of solution to this problem?

Ryan.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top