I assume this code is within the Form [frmMain]?
No,
the code above is in a popup form. It edits a field (fkLocationID) on the main form.
I have decided to edit that record using the main form's recordset instead of a (UPDATE) sql statement. I dont want to directly edit the record on the main form. I have to use a pop up for that. Since there are many ways to update a record in forms I was wondering if the second block...
User Profile
Collapse
-
Edit Record on a form using a popup form
Hi
I need to edit a specific record on a main form using a popup form. this is the code:
...Code:Private Sub resetThisForm(strAction As String) On Error GoTo ErrorHandler Dim rst As DAO.Recordset Select Case strAction Case "Swap" Set rst = Forms!frmMain.Recordset With rst -
-
-
Form Filter Length
Hi was wondering if this filter is ok to be shortened this way:
Month([DateProcessed])=1 AND Year(DateProces sed)=2021 OR Month([DateProcessed])=2 AND Year(DateProces sed)=2021 OR Month([DateProcessed])=3 AND Year(DateProces sed)=2021
changed to
Month([DateProcessed]) IN(1,2,3) AND Year(DateProces sed)=2021
Thanks -
date Filter on form (3 months, non consecutive)
Hi,
would like to filter a form with a form filter, the form has 12 buttons (12 months) and would like to retrieve records depending on which button is pressed.
This filter example works, it shows records from Jan, Feb, and Apr 2021 but I don't get why it shows them all. Should't it show just one month because I used OR?
Month([DateProcessed])=1 AND Year(DateProces sed)=2021 OR Month([DateProcessed])=2 AND Year(DateProces sed)=2021... -
NeoPa,
looking at the Northwind and other forms I assumed that, when the record navigation shows " 1 of 300" and on the right the filter says "UnFiltered ", the form would always load all the records but showed only the one specified by the "WHERE" clause.
I thought the filter on a form was a tool to manipulate the form recordset *after* the recordset was loaded. I didn't realize that applying a filter...Leave a comment:
-
Oh damn, that is so right.., moot and dumb but so helpful. Really appreciate it, ThanksLeave a comment:
-
"is pointless if u really need 10 and only 10 records.
What I was wondering was: would it be efficient to load 5000 records and then filter 1 if u only need one. Shouldn't u load just one and that's it? I suppose if the time taken is the same so thats ok.
I asked this question because I open popup forms using docmd.openform with a filter and assumed the records I see are the only ones in the form recordset but that...Leave a comment:
-
I kind of assumed that if I open a popup form this way (and i have 300 records in a table)
strWhere = "CategoryID =17"
DoCmd.OpenForm "frmProducts_Ed it_Sbf", acNormal, , strWhere, , acWindowNormal
the form recordset would contain and show say 10 records but in reality the popup form loads everything and shows only 10 which is pointless if u really need 10 and only 10 records.Leave a comment:
-
Docmd.openForm
Hi, just wanted to clarify one thing.
Using Docmd.openform will always load all Records but they are filtered using something like
strWhere = "ProductID= " & Me!ProductID
In this case the form will show 1 record out of say 260 in total but the form recordset contains 260 records. Correct? this is not great if you only want 1 record. Correct?
The only way to have only 1 record loaded... -
Thank u for your answers, in the end I have done what u suggested and also added this code to hide the smaller form once it loses focus
...Code:Private Sub Form_Timer() ' error trap is used to process situations when not a form is clicked outside of the popup form On Error GoTo NotForm: If Me.Name = Screen.ActiveForm.Name Then Exit Sub NotForm: Me.TimerInterval =Leave a comment:
-
I need to close it because I want the formLoad event to run again every time the yellow form is closed, how do you close the form just by focusing on the large form, tried with lost focus event but did not work
ThanksLeave a comment:
-
how about hide or close the yellow form when it goes to the back?Leave a comment:
-
Great thanks, I just did not dare duplicating data!
Interesting to add a date field in products, as you said a bit OTT for what I am doing but excellent answers
Thanks a lot!Leave a comment:
-
one to many relationship
Hi,
say you have a tblProducts table with the usual list of items and prices and create an invoice that contains a list of products (pkProducts in another table with other releshionships) and a year later decide to totally change the name of a product, that invoice is not correct anymore, if I print it will show the new product and not the original one.
Having a duh moment
Thanks -
they are 2 separate pop up forms, the smaller popup opens with a button within a subform of the large formLeave a comment:
-
work on 2 pop up forms
If u have 2 pop up forms opened, a large one and a smaller one, is there any way they can be both worked on and the smaller one always stay on top? Just like when u work in a form in design view in access, the property sheet is always on top and u can work on both. thanks -
-
for next loop
Hi, just a quick question, I wonder if there a better way to write the lines below, just trying to simplify and learn more elegant ways of writing codes,
Thanks all, hope u all well
[CODE]
Dim i As Integer
Dim textTab As Variant
Dim ctl As Control
...Code:For i = 0 To 9 Set ctl = Me.Controls("cmd" & i + 1) If i <= UBound(textTab)
No activity results to display
Show More
Leave a comment: