Creating a search form (having problems)

I not sure about your error, but you have some issues with fieldnames like Date, Resolve or Pending it might be access gets confused when you use Reserved and spesial words like this.

Perhaps somebody else can shed some lights on it.

JR :confused:
 
I have solved everything except the for the date filter, but I think I with just forego that for now.

The last part of this is that I'd like to make it so that once these records are searched out and displayed, that they can be edited.

I would like to have it so that the user needs to use command buttons to save changes, or another button to go back to the main page without saving the changes.

Do I need put these buttons inside the subform? What is the best way to do this?
 
On your date issue did you check the value of conJetDate? Because you are missing a # in it.

Code:
Const conJetDate = "\[COLOR=red]#[/COLOR]mm\/dd\/yyyy\#"

Now your date filter works. :)

Also the pending or unresolve issue, after thinking about it and checking you have defined the field in your table as text not number so you must put single quotes around the numbers to get this to work or change the field in your table to number.

I see your fixed it, so this was my attempt for an explenation of why this part errored. (i have now peace of mind and can sleep well) :rolleyes:

I would like to have it so that the user needs to use command buttons to save changes, or another button to go back to the main page without saving the changes.

Do I need put these buttons inside the subform? What is the best way to do this?

Your subform is bound to your table so I don't see a need for a "save" button. If the user sets focus to one of your fields in the subform and types something it WILL be saved to your table when the field is updated, aka exits the field. If this is not your intent you have to either lock fields or use some Before_update code to validate/allow updates to your table.

JR
 
Hi guys! When I try and filter by date

On your date issue did you check the value of conJetDate? Because you are missing a # in it.

Code:
Const conJetDate = "\[COLOR=red]#[/COLOR]mm\/dd\/yyyy\#"

Now your date filter works. :)

When I try and filter using dates with this code:

Code:
Const conJetDate = "\#mm\/dd\/yyyy\#"
 
'Search within a date range
     If Not IsNull(Me.txtStartDate) Then
         strWhere = strWhere & "([Date] " & Format(Me.txtStartDate, conJetDate) & ") AND "
     End If
    'Another date field example. Use "less than the next day" since this field has times as well as dates.
     If Not IsNull(Me.txtEndDate) Then   'Less than the next day.
         strWhere = strWhere & "([Date] " & Format(Me.txtEndDate + 1, conJetDate) & ") AND "
     End If

Hi guys! When I try and filter by date I am getting a really wacky error. The first time I try after opening my database I get the error:

Run-time Error '3075'
Syntax error (missing operator) in query expression
'([Date] #02/22/2009#) AND ([Date] #04/01/2009#)'.

The funny thing is that I only get the error on the first try, if I clean the fields and then enter 2 new dates (or even re-enter the same 2) and try filtering, I get this error (and keep on getting this error each time):

Run-time error '2448'
You can't assign a value to this object.


I'm really stuck!

P.S. I did make the change in the Const conJetDate that someone suggested earlier.

-Z
 
You need to add an operator after the [Date] part

either less than (<) or greater than (>) or equal to (=)
 

Users who are viewing this thread

Back
Top Bottom