Weird OrderBy Problem

Feb 21, 2006

Hi all,
Found a weird problem when editing records in continuous form view (and datasheet view) when a particular memo field is being used by OrderBy to sort the data. When i have just created a new record and tab to the next record, the record i was just in jumps to the top of the records, but in its place is an exact copy of the record above. Very confusing, and looks like a redraw bug but it happens on all PCs.

What happens is ... (letters relate to records going down the screen)

A
B
C
D ....new record being entered then <TAB> and ...

D ....has jumped up here
A
B
C
C ....duplicate of C - but duplicate record never created in the table
E ....new record

When i quit the form and come back in, everything is ok

As far as i know, OrderBy only takes effect if you refresh the form (which i'm not doing). It works fine if i take off OrderBy, or if i use another field with OrderBy. So is there some problem using OrderBy with a memo field, and how is this making my records jump about?

help!

Pete

View Replies


ADVERTISEMENT

Orderby

Apr 26, 2006

Hallo everyone,

I have a table with one of its column value as "B" or "D" or "E".

Now i am in need to display the rows using the select statement with the following conditions.

1. First display the rows with value "D"
2. then display the rows with value "E"
3. then display the rows with value "B"

Is it possible to specify the above condition in a orderby clause.

thanks,

aravind.s

View 1 Replies View Related

OrderBy With Wildcards

Oct 13, 2006

I am trying to get the OrderBy to recognize wildcards (or to that effect). A scenario would be I would have more than one name in a field, EX: Name2, 4, 6. How do I use wildcards in the OrderBy and they are recognized.

ORDER BY (Table.Field)="Name1", (Table.Field)="Name2", (Table.Field)="Name3", (Table.Field)="Name4", (Table.Field)="Name5", (Table.Field)="Name6", (Table.Field)="Name7", (Table.Field)="Name8";

View 2 Replies View Related

Listbox OrderBy

Jun 20, 2006

Hi,
I have a list box based on a quite a complex query. I would like give the user the option to dynamically sort the list box.

How can I refer to my listbox's SQL rowsource and add a sort order using VB?
i.e.
Private Sub CmdButtonSortByName_Click
Dim strSQL as String
strSQL = me.listbox.rowsource & "ORDER BY FieldName;"
me.listbox.rowsource = strSQL

I am aware of how I could do this if my SQL was in VB i.e.:

Dim strSQL as String
Dim strSortOrder as String
Dim optSort as Integer

Select Case optSort.Value
Case 1
strSortOrder = "ORDER BY LastName;"
Case 2
strSortOrder = "ORDER BY FirstName;"
End Select

strSQL = "SELECT FirstName, LastName FROM TblName " & strSortOrder
Me.ListBox.Rowsource = strSQL


....but my query is far more complex than this and I dont want to have to keep calling the code each time I need to requery my form.

Thanks
BF

View 14 Replies View Related

Orderby Syntax

Nov 2, 2004

I want to basically perform a "Sort by ascending" Function.

I presume I have to grab the focus of the Item I want to order by.

So :

me.(Field).Setfocus

But then what is the code for running the Sort by ascending/Descending?


My data is currently in a list of text boxes. When I normally 'Sort by ascending' the function works fine.. so I just need to activate that....

View 4 Replies View Related

OrderBy Problem

Apr 15, 2005

In my db I have a report that I would like to sort by different fields. I tried coding this using option buttons, a command button, and the "Case" statement. While putting in the OrderBy portion of the code I keep getting errors in relation to the syntax. I'm not sure how long I worked with it and got absolutely nowhere. Can someone clue me in please? Here's my code:

Private Sub Command14_Click()
Select Case Me!Frame5.Value
Case 1
'Sort by Military Occupational Specialty (MOS) ascending
DoCmd.OpenReport ("Report1")
OrderBy MOS

Case 2
'Sort by Military Occupational Specialty (MOS) descending
DoCmd.OpenReport ("Report1")
OrderBy MOS, DESC

Case Else
MsgBox ("Please select an option before attempting to open the report.")

End Select
End Sub

View 6 Replies View Related

Using OrderBy Gives Error At Reopening Form.

Nov 15, 2006

I have a form where the recordsource is a stored procedure.

This forms shows a list. When the user clicks on a column title, the column is sorted by using OrderBy in VBA:

f.i.:

Private Sub lblCode_Click()

Me.OrderBy = "strCode"

End Sub

As a result, in the properties of the form, for the property Order By, the fieldname is filled in (f.i. strCode).

This works fine, but when the form is closed, access saves the property Order By.

Next time the form is opened, it gives an error: The recordsource <storedprocedurename> specified on this form does not exist.

When I remove the fieldname in the Order By property of the form, the form opens without an error.

I have tried to clear the Order By property by using Me.OrderBy = "" in the Close event of the form, but this does not work.

Any solution ?

View 2 Replies View Related

Modules & VBA :: OrderBy When Opening A Form

Nov 29, 2013

I'm trying to have a form sorted in a particular order when it's opened.

When using the "order by" option in the properties sheet, it is sorted the way I want the first time I open the form.

However, if I change the order afterwards while using the form (for instance, by right clicking and selecting another sort order), well the next time the form is opened, it is sorted with this new sort order, and not the default one.

So I tried to add the following code :

Code:
Private Sub Form_Open()
Me.OrderBy "employee_name ASC"
Me.OrderByOn = True
End Sub

Which failed epically.

View 6 Replies View Related

Transfering RecordSource/OrderBy Of Form To Report

Oct 17, 2006

I have a subform within a form that displays filtered data based on dynamic selection criteria which is assigned to the RecordSource/OrderBy of the subform. On this form, I have a "Print Results" button -- OnClick, I would like the RecordSource/OrderBy of the subform to be copied to the Report, then run the report. What I have that doesn't work is:

Reports!rpt_frmTaskMain.RecordSource = Forms!frmTaskMain.frmTaskSub1.RecordSource
Reports!rpt_frmTaskMain.OrderBy = Forms!frmTaskMain.frm.TaskSub1.OrderBy

On execution I get error: "Object doesn't support this property or method"

I am thinking this can be done, and likely have the references wrong. Help?

View 1 Replies View Related

Forms :: Can't Clear Filter Or Orderby Permanently On Form

May 14, 2013

I have a tabular form that is based on a select statement (Query) in the source property. It filters & sorts from this select statement. permanently

I have just added a
Me.Filter = "[Form1].[InDate] = #" & MyValue & "# "
Me.OrderBy = "Indate DESC"

This all works fine, filters & sorts on the existing results.However this new filter & sort seems to remain no matter what I do.I have used every variation one me.filter ="" with Me.FilterOn = True, False & every combination.

Me.Filter="" & Me.FilterOn = False does initially seem to clear the lsit to show all records but as soon as type anything that filters the Form on the original, existing underlying select statement the extra Filter Property & Sort properties are occupied with the last filter/sort.

I have manually deleted any remaining Filter Or Sort properties direct from design view, saved, compacted & saved again.Once I use the new me.filter it will always returned as soon an any filter on the form is applied.I definately am not setting it again anywhere. Is there something better than me.filter ="", seen clearallfilters mentioned but not sure if this would apply just to the current form but reluctant to use a blanket clear as I do have quite a lot of other things going on.

Not sure when but many months (If not years) ago my form source stopped being a query and started using the query (sql) direct from the source property.I have left it this way as not sure if any consequence of moving back but don't remember how or how it happened. What are the pros cons of using a separate query.

View 4 Replies View Related

Modules & VBA :: Form Filter And OrderBy Pass To Report

Aug 16, 2014

I am able to filter a data on a continuous form using drop downs and then the following code attached to a cmdbutton to create a report of the filtered data.

Code:
Private Sub Command30_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "rptconveyorerrors", acViewReport, , strWhere
End Sub

On the same form where I filter the data i can sort it by clicking the headings aswell, however when i generate the report using the above VBA it doesn't take the sort with it and just generates it without the sort.

I am using the following VBA to sort my form

Code:
Me.OrderByOn = True
If Me.OrderBy = "[empname] DESC" Then
Me.OrderBy = "[empname] ASC"
Else
Me.OrderBy = "[empname] DESC"
End If
Me.Refresh

I thought it may be possible to use the following sort of VBA to pass the sort however i cant get it to work:

Code:
Private Sub Command30_Click()
Dim strOrder As String
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
If Me.OrderByOn Then strOrder=Me.OrderByOn

View 1 Replies View Related

Weird Bug ?

Oct 12, 2007

Access 2003 -

I have many queries in a DB. they work fine, but *sometimes* some of my queries are wiped - when i try to run them they say "query must contain at least one cell" or something..

when i check the query then, its empty!

I have saved out the SQL code into a word doc because this has happened a few times now.. so i just copy and paste the query back in - but this is very inconvenient! what is going on?

View 1 Replies View Related

Weird!

Oct 25, 2004

I have 2 unbound boxes in the footer of my continuous form. Both total up separate sets of fields using DSum and do it correctly. I have used Conditional Formatting on Total1 to make the numbers turn bold and red whenever Total1 is greater than Total2.

Here comes the weird part. It will always work whenever Total1 is greater than Total2, but sometimes when Total2 is bigger, Total1 is still red, even after I attempt to modify it and it requeries, or I go to a different record and come back. Any thoughts??

Thanks

-Jason

View 6 Replies View Related

Weird Issue

Jan 24, 2006

I have a weird issue going on...I'm running a "Find Duplicates" query on one of my tables, I'm only checking for duplicate values in 2 fields and outputting a third. now this runs fine, unless I use the total's button to group them. When I group them that access instance stops responding. The reason I'm doing this is the third column can have duplicate values, for my purposes it doesn't matter, but I need to be able to see it.

I'm running this against 120k records.

Anyone help a poor man out?

View 2 Replies View Related

Weird Question

Aug 14, 2006

Ok, a friend of my was on my laptop and he crashed the hardrive. I was able to get the database I have been working on off the computer but when I use my computer at work to try to open it, it opens but says
"Function is not available in expressions in tabel-level validation expresions"
on all the date-time functions. I can't save anything and my queries are not running because of this date/time thing. Anybody know what is going on?

View 1 Replies View Related

Weird Messages

Sep 11, 2006

I modified a form in an existing split database, by simply adding several fields. Now, I get various messages such as " not Access database "
or if it opens, the following message when I try to close it:
"Your last change may not have been changed because an internal buffer was locked by another user... "

Plus, when I do get out, I cannot delete the .ldb file which it says is open by Administrator. The thing is I ma only one to try this new database and I set no permisasions or... ?

Please, any ideas?

Russ

View 1 Replies View Related

Weird Help Requested

Feb 5, 2007

sorry,

there are too many requests and not enough information to easily create the required reports for my customers.

I want to copy a table/query with yes/no fields and paste into excel with the
boxes for the yes/no fields. . .

I can't remember or figure out how to do it. . .

I know it can be done as I have done it before, how, i can't recall. . .

thanks

sportsguy
:insert idiot emoticon:

View 5 Replies View Related

Weird IIF Problem

Aug 22, 2007

Hi, I have a table with two fields: CustomerName and OrderNumber.
Some order numbers have dashes, for example:
123-4, 123-5, 123-6 etc.
I wrote a query to strip those dashes from these ordernumbers, but only for 3 specific customers: Mark, Mike and Jane.
This is the query:

SELECT CustomerName, OrderNumber,
IIf(InStr(1,[OrderNumber],"-")<>0 And InStr(1,[OrderNumber],"-B")=0,
IIf([CustomerName] Like '*mark*' Or [CustomerName] Like '*mike*' Or [CustomerName] Like '*jane*',
CStr(Mid([OrderNumber],1,InStr(1,[OrderNumber],"-")-1)),
CStr([OrderNumber])),
CStr([OrderNumber])) AS NewOrderNumber
FROM Test
GROUP BY CustomerName, OrderNumber,
IIf(InStr(1,[OrderNumber],"-")<>0 And InStr(1,[OrderNumber],"-B")=0,
IIf([CustomerName] Like '*mark*' Or [CustomerName] Like '*mike*' Or [CustomerName] Like '*jane*',
CStr(Mid([OrderNumber],1,InStr(1,[OrderNumber],"-")-1)),
CStr([OrderNumber])),
CStr([OrderNumber]));


This query works great when I run it from Access. However, if I run it from Visual Basic .NET, it does not strip any dashes for any customers. I am using the following connection string:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C: est.mdb
And the following query:
SELECT * FROM [Strip] ORDER BY NewOrderNumber
(Strip is the query name in Access)

Did anyone encounter a problem like this before?

Thank you,

Nader

View 2 Replies View Related

Weird Problem

Jul 18, 2005

hi all,

i have .adp projects.I am facing a problem for which i dont find any reason.whenver i open 2 .adp projects they hang up.I have to kill the msaccess.exe

It okay if i m running 1 project but i have to logout to open the second project.I can not run both at the same time.

Any help on this pls..

View 1 Replies View Related

Weird Error

Sep 2, 2005

I am creating a switchboard to access a few data entry forms and to preview reports before printing. It seems that whenever I add a button to preview a certain form(the 4th button on the form, all others work fine), Access goes crazy. I get several errors, including:

"You have entered an expression that has an invalid reference to the propery MaxRecButton. "

and

"The Open Form action has been canceled"

Im also getting crashes to desktop and low memory errors.

Now I am getting "referenced memory" "memory could not be wrriten" errors? Is this an Access problem or a "need a computer upgrade" error?

Any clue why this might be happening for this form?

View 1 Replies View Related

Weird Question

Nov 7, 2005

hi,
got a weird question.
Im working on a form atm (duh)
I have a form that exists in more tables.
Now you have 2 solutions: I can use a query and generate the form, or i can make various subforms.

what is the best option? or doesnt it make much diffrence?

View 2 Replies View Related

Weird Dlookup Help

Oct 1, 2004

I am creating a database. There are two main tables - Table 1 is created via a Make Table query, which pulls from an Oracle db, which is the db for our department's customer service system. Table 2 is populated via a form. Table 1 has personal customer information and Table 2 has order information. The two tables share a Customer ID. Table 2 contains data that was imported from an Excel sheet (what the users had been using up until this db was created). For this example, let's say each customer will only ever have one order so there will be a record to record match. Also, since Table 1 has to be manually refreshed using real-time data, it may lag behind or be ahead of Table 2.

Here's my problem:
I want the user to see the customer's name when he/she types in the Customer ID. I got the DLookup to work for NEW records - that is, for records that exist in Table 1 but have not yet been entered into Table 2 - but it will NOT work for the 300+ records that I imported from Excel. For those records, the Name textbox remains blank or if I type in the Customer ID, gives me an error about entering duplicate values.

Furthermore, if Table 1 is lagging behind Table 2, I want the user to just go ahead and enter all the order information and when he/she goes back to update the order at a later date (after Table 1 has been refreshed), the name to just pop up.

Can anyone help or offer any thoughts?
Thanks.

View 4 Replies View Related

Weird Question

Aug 14, 2006

Ok, a friend of my was on my laptop and he crashed the hardrive. I was able to get the database I have been working on off the computer but when I use my computer at work to try to open it, it opens but says
"Function is not available in expressions in tabel-level validation expresions"
on all the date-time functions. I can't save anything and my queries are not running because of this date/time thing. Anybody know what is going on?

View 5 Replies View Related

Weird Querry!!

Oct 13, 2006

Hi,

I have this querry but when I execute on a button click it dosen't give me any error....but no data is saved in the table, why????

strSQL = " UPDATE DISTINCTROW projet set id='" & txt_id.Value & "',code_NOP='" & txt_code_NOP.Value & "',client='" & txt_client.Value & "',libelle_projet='" & txt_libelle_projet.Value & "',id_clarity='" & txt_id_clarity & "',technologie_projet='" & txt_technologie_projet.Value & "',em='" & txt_em.Value & "',date_debut=#" & txt_date_debut.Value & "#,date_fin=#" & txt_date_fin.Value & "#,site_mandataire='" & txt_site_mandataire.Value & "',charge_totale=" & txt_charge_totale & ",ca_total_vendu=" & txt_ca_total_vendu.Value & " WHERE id='" & Form_projet.id.Value & "';"

View 7 Replies View Related

Weird Behaviour Of Like

Dec 14, 2007

This outputs smth
SELECT Proj_Name & '-' & Proj_ID as Emp_Pr from Emp_Prj where trim(Proj_Name) like trim('Dot')
------
But not this...why ??? I am using ms access
SELECT Proj_Name & '-' & Proj_ID as Emp_Pr from Emp_Prj where trim(Proj_Name) like trim('%Dot%')

View 2 Replies View Related

Weird Problem

Feb 21, 2008

Okay guys. This one may not be able to get answered. I made a report in Landscape view. However, when you look at it on a different computer, it shows portrait. I know what your thinking, but I checked the page setup and everything and it says it's in landscape view. Even when I print it, it prints in landscape. Does anyone know why this one computer refuses to show landscape? Has anyone ever seen this problem before? I don't even know where to start to fix it. It's just weird!

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved