Search Form Appearence

iliast

Registered User.
Local time
Tomorrow, 00:53
Joined
May 21, 2007
Messages
26
Hello to everybody. I have a Search Form with two options as criteria. "Days" and "Works" of each day . Days is a combo box with the days of the week. Data of combo box are records of the Days Table . Although the days of Criteria Section appear as words, the results appear by the DayID of the the Day Table. How can I make them appear as words? The attachment is the Search Form including the code. Forgive my mistakes in English (I 'm from Greece). Thank you all.
 

Attachments

First of all, I am getting an error on open, which may have to do with the localization settings. But essentially the fix is this:

1. Get rid of your lookup at table level (under DayID in table - Works). When you open that table in Design View, and you click on the field then go down to the bottom of the page and find the tab that says LOOKUP.

2. Click on it and then change the thing that says COMBO BOX to TEXT BOX. That will remove the lookup. You shouldn't have lookups at table level. See here for more info:
http://www.mvps.org/access/lookupfields.htm

3. Then, change your form's recordsource to a QUERY, not the table, so you can join the tables with DateID and instead of displaying DateID in the form, select DAY from the other table.
 
Thank you for the response. If I understood right in table Works I must change the look for the field DayID from a combo box to text. If I will do that, what is the purpose of table Days existence?
 
It's what you use a FORM for, you still use a combo box that has the rowsource of the table: days but stores the value of it's ID in the Works table. You shouldn't work directly in the tables or queries, but you should work in forms so that you have control over things and have events to be able to have code run based on those events.
 
I'm not an expert. Not even a tolerable enough access user. And my english is poor. What exactly must change into code or outside the code?
 
The code (if the .zip refuse to open

Option Compare Database
Option Explicit

Private Sub cmdFilter_Click()

Dim strWhere As String
Dim lngLen As Long

If Not IsNull(Me.FilterDay) Then
strWhere = strWhere & "([DayID] = " & Me.FilterDay & ") AND "
End If

If Not IsNull(Me.FilterStreet) Then
strWhere = strWhere & "([Street] Like ""*" & Me.FilterStreet & "*"") AND "
End If

lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "Insert kriteria", vbInformation, "Nothing to execute."
Else
strWhere = Left$(strWhere, lngLen)

Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub

Private Sub cmdReset_Click()

Dim ctl As Control

For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next

Me.FilterOn = False
End Sub

Private Sub Exit_Click()

End Sub

Private Sub Form_BeforeInsert(Cancel As Integer)

Cancel = True
MsgBox "You can't add data.", vbInformation, "Action rejected."
End Sub

Private Sub Form_Open(Cancel As Integer)
Me.Filter = "(False)"
Me.FilterOn = True
End Sub
Private Sub ExitForm_Click()
On Error GoTo Err_Exit_Click


DoCmd.Close

Exit_ExitForm_Click:
Exit Sub

Err_Exit_Click:
MsgBox Err.Description
Resume Exit_ExitForm_Click

End Sub
 
I have tried to fix things in your db, but I still think that there is something that is keeping me from running the form due to the fact that it is a Greek version. So, I can't test it to make sure.

But, you didn't get rid of the lookup field in the table Works (DayID) so I did and then modified the rowsource of the day combo box.

Hopefully we can get it working for you but since I can't run it (I get an automation error when the form loads) I can't help much more.
 

Attachments

Last try mr Bob. Try this .zip. Its the one you sent to me, fixed (the greek is english now everywhere). Run it to test it.
 
the file. i forgot it into the last message
 

Attachments

Users who are viewing this thread

Back
Top Bottom