Combo box search no longer works, and forms do not show records!!! (1 Viewer)

pityocamptes

Registered User.
Local time
Today, 09:43
Joined
Dec 8, 2010
Messages
27
I have no idea what happened. For some reason my combo box search box is no longer working - the form is not being populated by previous records. When I click on the combo box I can see ALL of the records stored in the database, but when I click on the record it fails to populate the forms.

Not only that but lets say I enter a couple of new records, I can see them when you scroll through the records ribbon at the bottom. If I close out the form and reopen it, it starts off with a (New) and the previous records do not show. However, when I look at the databases, all of the information is stored. I am not sure what is going on, but could use some help. Thanks!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:43
Joined
Aug 30, 2003
Messages
36,139
What is the Data Entry property of the form? What is the code that opens it?
 

pityocamptes

Registered User.
Local time
Today, 09:43
Joined
Dec 8, 2010
Messages
27
What is the Data Entry property of the form? What is the code that opens it?


Data Entry is set to yes. The code that I have to open it is:

Code:
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long
 
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
 
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
     
Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
If Procedure = "Hide" Then
    dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
    dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
    dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
    If IsWindowVisible(hWndAccessApp) = 1 Then
        dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
    Else
        dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
    End If
End If
If StatusCheck = True Then
    If IsWindowVisible(hWndAccessApp) = 0 Then
        fAccessWindow = False
    End If
    If IsWindowVisible(hWndAccessApp) = 1 Then
        fAccessWindow = True
    End If
End If
End Function
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:43
Joined
Aug 30, 2003
Messages
36,139
The data entry property being set to Yes is what's preventing previous records from showing. With that property, you're telling Access you want the form to open to a new record, and only display the new record(s).
 

pityocamptes

Registered User.
Local time
Today, 09:43
Joined
Dec 8, 2010
Messages
27
The data entry property being set to Yes is what's preventing previous records from showing. With that property, you're telling Access you want the form to open to a new record, and only display the new record(s).


Ok, so set them ALL to no? Thanks again!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:43
Joined
Aug 30, 2003
Messages
36,139
Not sure what you mean by "them ALL". You'd set each property as appropriate to your needs. I'd expect data entry set to no, the others to yes.
 

pityocamptes

Registered User.
Local time
Today, 09:43
Joined
Dec 8, 2010
Messages
27
OK, I changed it to "no" and created a new search combo box, but nothing works. I see the data in the drop down combo box, but when I click on it, the form does not fill. Also, the search ribbon at the bottom does not show any previous records... help...
 

pityocamptes

Registered User.
Local time
Today, 09:43
Joined
Dec 8, 2010
Messages
27
Also, should I be seeing some type of code or Event Procedure when using the wizard for the combobox? Because when I click on the Event tab for the combo box nothing appears in the After Update. Is this normal? Thanks again!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:43
Joined
Aug 30, 2003
Messages
36,139
Yes, there should either be [Event Procedure] or an embedded macro in the after update event (2007 creates the macro, previous versions created code). Can you post the db?
 

pityocamptes

Registered User.
Local time
Today, 09:43
Joined
Dec 8, 2010
Messages
27
Thanks! I found this code for the event procedure:

Code:
Private Sub Combo142_AfterUpdate()
  Me![UserID].SetFocus
  DoCmd.FindRecord Me!Combo142, acEntire
End Sub

However, now I am getting this error:

Run time error 2137 - You can't use Find or Replace right now...


This even though the table shows that I have several records... suggestions? Thanks!
 

pityocamptes

Registered User.
Local time
Today, 09:43
Joined
Dec 8, 2010
Messages
27
I figuered it out. I had some funky SQL statement for the form, which I have no idea where it came from. It was messing up the search and combobox. Fixed that, and all seems to be working great now. Thanks for the help.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:43
Joined
Aug 30, 2003
Messages
36,139
Ah good, glad you got it sorted out. I've been working on a project.
 

Users who are viewing this thread

Top Bottom