The sort order is set in the form properties. I stand partially corrected though as I now have it working using me.requery. Above is the entire code for Copy Record button and it wasn't working initially, but I cleared out a bunch of unnecessary code in other areas of the form that may have been conflicting with it and now it works.
Now, though, regardless of which record I am on when I click my copy button, the top record has the...
User Profile
Collapse
-
Adding me.requery after my new record code doesn't work.
The new record is still at the bottom of the form.Code:DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdCopy DoCmd.GoToRecord , , acNewRec DoCmd.RunCommand acCmdPaste Me.RequeryLeave a comment:
-
Re-Apply Sort After New Record
I have a form that loads with all data currently in an employee table. I am trying to allow the user to duplicate a record and then have the form re-apply the sort so that the newly created record is in order with the rest rather than being at the bottom of the form.
Here is my current copy/paste code:
...Code:DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdCopy DoCmd.GoToRecord , , acNewRec
-
I would say they both work equally as well. Slow and inefficient as you expected, but nonetheless accomplishes what I asked.
As always, thank you for your help jforbes!Leave a comment:
-
Table Relationship with Blank Values
I am working on a query that'll find invalid entries. My users enter payroll data into a form and the form only allows them to enter active Cost Code & Job/Sub Job combinations, but often enough they change something after initial entry that results in an invalid combination.
In my query, I have a relationship created between my Data Import(Payroll entries) table and a table of current/active cost codes (see attached). With that... -
If anyone understands the background process of this and can explain further, it would be greatly appreciated! My best guess is that the initial FilterOn = True action creates a background query that doesn't clear or refresh with the FilterOn = False action.
I have found that adding a requery line allows the criteria to update, so unless someone has advice for a better approach, this appears to be solved.
...Code:Private Sub
Leave a comment:
-
After applying filter the filter property In design view is populated. After clicking remove filter, the filter property is blank in design view...as I'd expected. So, I'm not sure why it's not updating the filter input.
HoursCurrent is a table, job is a field within that table. It is a text field.Leave a comment:
-
Access Filter not Clearing
I have a continuous form with a combo box at the top that I want to use as a filter criteria. I am able to successfully apply the filter. I am also able to clear the form filter property when done. But, if I change the value in the combo box and re-apply the filter, the form filters on the initial criteria, it doesn't update to the new combo box input.
How can a completely clear any "hidden" filter criteria so that the... -
An interesting new development. I discovered that the initial repetitive prompts were due to the query's WHERE criteria:
...Code:INSERT INTO Equipment ( EquipNumber, [Desc], AddInfo, AdgndTo, Model, EqYear, Specifications, SerialNum, Dept, Class, Type, OperationalCode, OwnershipCode, UtDHour, UtDMiles, UtDMeter, LicenseNum, LicenseExp, DateAssigned, StatusCode, StatusDate, InternalLocWare, VendorNum, UDCBudHours, UDCHourAtAcq, UDCPrevEqID,Leave a comment:
-
Rabbit: If I isolate the select portion, the query prompts for the new equip number, then prompts for all the other unspecified fields, then cycles back to the new equip number prompt 2 more times. When testing this, I actually only have 1 record in my table, so the query shouldn't be trying to replicate multiple records.
To add to the oddity, when I step through the button click code, the input function cycles through 3 times after...Leave a comment:
-
Function Cycles Multiple Times
Can anyone explain to me why my function loops through 4 times when I expect it to only run through once?
The end goal is to copy a record and assign a new equipment number during the process.
My button click code:
...Code:Public Sub btnCopyRecord_Click() If Not Me.NewRecord Then DoCmd.OpenQuery "Copy Equipment" DoCmd.RunCommand acCmdCloseWindow -
Thanks for the tip. With that advice, I looked further into how to pass an argument and seem to have everything working now.
On click even from a report field:
On Load event of the form using the passed argument:Code:Public Sub RptEquipNumber_Click() ArEq = RptEquipNumber DoCmd.OpenForm "Equipment", , , , acFormReadOnly, , ArEq End Sub
...Code:Public Sub Form_Load()
Leave a comment:
-
Change Form Record Source
I am trying open a form from VBA to view a record that was moved from the original table to an Archive Table. I am having a hard time changing the record source of the form to look at the Archive table instead of the original table. If I open the form first, I am able to change the record source, but am then unable to filter to the selected record since the form is already open.
Does anyone know if I am able to change the form properties... -
Thanks again. Adding Undo didn't appear to change anything. I had already started thinking of other approaches as there is always more than one way to accomplish the same task. While reading your comments again, I realized that I had some code elsewhere that was created from a system macro converted to VBA that has essentially the same task, but without the prompt. I was able to borrow that chunk to accomplish exactly what I want.
...Leave a comment:
-
jforbes: thanks for that bit of info. Based on what you said, I re-examined my code and moved a few things around so that I was able to use Cancel. The action functions as I would like it to now, but the default Access prompt, "You can't save this record at this time." still pops up prior to actually closing the form. Is there a good way to silence this prompt or to preemptively select yes?
...Code:Private Sub Form_BeforeUpdate(Cancel
Leave a comment:
-
Runtime Error '2501'
I've reviewed numerous solutions to others with the same error and for some reason I just can't seem to get past my issue... please help!
...Code:Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(Me.EquipNumber) Then Do InputEq = InputBox("An equipment number is required. Please enter a value:", "Missing Equipment Number") If InputEq -
The form is actually being used for time entry, so the user isn't occasionally retrieving and updating records, but rather entering many records consecutively at approx 30-45 secs per record. I have thought about other ways to approach the refresh pattern, but I have totals in the form footer that are used to tie against the paper time card. I would like these form totals to remain as accurate as possible, which is why I have the record(form) refresh...Leave a comment:
-
Refresh Efficiency
Hello!
I currently have a continuous form and am using Me.Refresh as an After Update event for multiple controls on the form. Everything preforms great when there is a single user, but when multiple users are running their DB (back end is split out, each user has their own front end DB), performance becomes slow and choppy. (Bottleneck points appear to be at each refresh) I have already attempted to remove a few refresh points, but... -
Thank you jforbes and Rabbit for your insight. You have certainly confirmed my thoughts on the root of the issue. I was using a dlookup expression which was the worst for calculation time. Even just having a conditional format for Has Focus was still minimizing the drop list. Ultimately what worked for me, and this is certainly more of a work around than a fix, was to do a text box behind the entry box, assign the formatting to that box and set...Leave a comment:
-
Conditional Formatting on a Combo Box
Hello Everyone!
I have a continuous form that is used to enter time data. I have a couple fields, such as employee number, that are Combo Boxes. The user is able to enter an employee number that is not in the employee table, so in that situation, I set a conditional format to change the control red to indicate the absence of that number.
My problem seems to be the timing of the many calculations occurring...The conditional...
No activity results to display
Show More
Leave a comment: