hello i wish to trigger some VBA code when the user jumps from the present record to some other record on the form. there is the On Current event but that only applies to the record you are jumping to. i wish to process the information on the present record if u choose to jump to some other. BTW my form my form only shows one record at a time.
Please help me out here. :confused:
im working on an access report and would like a little vba script to run on when the page prints out the next record (mostly just need to hide/unhide a few objects and change the value of a variable on the report when it prints the next record)how i can trigger this (as there seems to be no onNextRecord event handler)
edit: upon a better inspection of the reports record source i realized that on next record doesnt actually work (i could force it to by adding a few new fields to queries and forcing endless loops), what i needs actually a lil more complicated
my report has a header, in the header is a field called productionNo, the record source has multiple instances of prodno's with countless duplicates, what i need is a function to trigger when the productionno changes, there will probably be a few pages with the same production number (theyd be grouped together though), so it should only trigger when the value changes, not when it stays the same
There are around 100 customers.And on application open, need to check if customer has paid invoice. If the customer has paid/not paid need to change the status accordingly. Form on open event changes status of only the first customer.Form on current changes status only if we move to the specific record. Is there an event to trigger to check the entire table records on application open?
I have a project that contains about 200 very small .mdb's. For reasons that make no sense, I have to keep all these little .mdb's separate.
What I'm interested in doing is to run a query against a table in each of the .mdb's and if I find a certain record in the table within each .mdb, have a record written that contains the name of the .mdb in which the record was found . In other words, cycle through all my .mdb's, check my specified table, write my notification record, and then repeat the process for the next .mdb.
Can this be done? Does anyone have an idea or suggestion? I know I can do this separately, but that would be a pain.
If anyone can offer assistance, I would be most appreciative. Thanks!
I have the following code that Cycles through a listbox that has columns associated to it:
Dim db As DAO.Database
Set db = CurrentDb
lstOrigin.SetFocus For i = 0 To lstOrigin.ItemsSelected.Count - 1 txtAmount.SetFocus For x = 1 To CInt(txtAmount.Text) strsql = "insert into tmpJob select dbo_jtJob.* from dbo_jtJob where jtJobId = " & lstOrigin.Column(0) db.Execute strsql Next Next
This code works fine and so if I multi-select the lstOrigin.Column(0) value changes correctly as expected..
I now have a second listbox also set with columns and set for multiselect:
The code I have for this is :
Dim i As Integer Dim strCriteria As String
strCriteria = "key in (" lstDestination.SetFocus For i = 0 To lstDestination.ItemsSelected.Count - 1 strCriteria = strCriteria & lstDestination.Column(0) & ", " Next strCriteria = Left(strCriteria, Len(strCriteria) - 2) & ")" DoCmd.OpenForm "JobCreateTemplate", , , strCriteria, , acDialog
Now in this one lstDestination.Column(0) always equals the last item in the items selected index. It iterates the loop the correct number of times. I cannot see what I've done different that the process works in the first lot of code and not the second.
I'm trying to set up a looping code to go thru each record in a query. I know in excel I would set the cell value to a range and offset to get to the next value. How is this done in Access?
I have a form with a list box, which lists all those registered for a student orientation. I then have a button to an unbound report which prints a registration worksheet. This report looks up the student's name, test scores, suggested courses based on those scores, and various other information from multiple tables, assigns them to variables, then to controls on the report. This is done in the On Open event of the report.
But it was designed to work for record highlighted. Which was fine until now. Now I'd like to take it one step further and have it go through the list from beginning to end, printing the report for each record in the list.
Maybe I am missing something simple, but I can't seem to pull it off. The closest I can get is getting it to print the first record n times.
Only 1 field between INV, MSP and SMS in any record will be >0 What I need to do is that if the value in these 3 fields are > then populate TRIGGER with the correct name
Hi i am trying to create a query for reporting purposes that will run automatically on say a monthly or weekly basis. please help. I dont want it to run off a macro or button but for the report to be generated automatically and stored after a given time period.
Hi, I have a database in Access. I have a form that is accessed by several users on a network. There is one field called the Employee ID. Whenever this field is changed, I should receive an email that says that the field has changed. We have Lotus Notes installed on the network. Can someone help me out thru this? Any help whether this can be done or not is also appreciated.
I am completely new to Access and I'm trying to make a Birthday auto email type thing.
I want the program to email people to say Happy Birthday on the day of their birthday but I haven't a clue where to start and the Microsoft website confuses even more.
I have used the database template Mailing List with the First Name Last Name Address Email Address & Date of birth.
I'm not sure if this is the proper forum for this post. I have a database in access in which i need to mimick a trigger like behavior. As far as I know access does not support triggers. When a user updates a record I need a LastModified date field to be updated with the current date automatically.
I've seen several examples of how to accomplish this using forms, however, the users of this database do not use forms. They are editing the records by hand by opening up the table and simply typing.
Hi im going to make an update query to deduct the quantity purchased of a product from the stock amounts but i need it to run the query automatically everytime a new record is added to the table
When the close button on the top right of the form is pressed I want the following code to be run:
Private Sub Form_Close()
Dim preview As Boolean Dim checkForOldBooks Dim count As Integer
preview = False
count = DCount("*", "tblOldItems")
If count > 0 Then Call saveAndOutput_Reports("rOldBooks", "oldBooks", preview) Call saveAndOutput_Reports("rBarCodeList", "BarcodesScanned", preview) Else Call saveAndOutput_Reports("rBarCodeList", "BarcodesScanned", preview) End If
DoCmd.Close
End Sub
I put this code in the Form_Close trigger because I want it to execute everytime the form is closed. The problem I'm having is when I run the form and press the close button the code does not seem to execute. However if I put a breakpoint in the trigger, run the form and press the close button, the program does go into the trigger and the code executes as it should when I step through it.
To troubleshoot I also created a button and added the above code, when the form is run and the button is pressed the code executes as it should it just does'nt work in the close_form trigger.
Thanks to S.baxter I have used some code to loop through a recordset and select each record in turn in a form that uses the recordset as the Rowsource of a combo box. However, there is an After_Update event attached to the combo box which is not being triggered.
MS Help says :- "If you move to another record or save the record, the form's BeforeUpdate and AfterUpdate events do occur." I have tried this but can't get it to work. Would it work if I could move the focus to another control on the form and if so how do I do that?
I am creating a student database in Access. I have connected a number of tables through primary keys with RI.
When I create a new record in the student table, I need to insert the student id manually in the grade table.
In SQL Server, I would use an insert trigger to do this automatically. How about in Access?
I need to get this new student id in a number of similar tables: scores, assessments, terms.
I have been populating the student table with data, exporting to access, importing as a new table, adding the id field, creating the relationship, then populating the table with the missing data, which is very labor intensive.
I have a lot more data to enter.
An easier way to do this in Access would be greatly appreciated.
I am new to MS Access, and I am wondering if there is a way for Access to automatically send an email to a defined address everytime a record is added to a specific table? I have created an escalated issue table and I would need an employees manager to be notified automatically when a new record has been added to it.
I'm working on a project where I'm migrating the tables from an Access database to a SQL Server database. A few of the Access tables contain fields with validation rules. I'd like to keep this validation and I've read that the best way to do this is to create a trigger in SQL Server. Can someone give me a clue as to how to do this? Here's an example of a field and validation rule I need to convert:
Field Name: StatusCode Data Type: Text Field Size: 1 Validation Rule: "A" Or "B" Or "C" Or "" Validation Text: Needs to be A, B or C
I have a main order form with a subform for order datails (products, quantity, extended price, etc..). The default way of calculating a selling price is by using the cost plus a profit margin (the margin is a percentage defined on the main form)
But sometimes we want to define the selling price differently, bu using the List price instead, on which I can apply a discount. So what I did is put a checkbox field on my subform, and when the checkbox is "true" the selling price is now the list price field from the products table instead of the "cost plus" calculated field.
So far everything works perfectly as described. The only that I am now left to do is to be able to "ask" for the desired discount when the checkbox is selected. What I mean is that when the checkbox is clicked (true), I would like for a dialog box to pop-up and ask for the discount that should be applied to that record in the subform...Is there a way to do that with a "msgbox" or should I make a small form with only one field on it?...
The main reason why I want to do it this way is that I dont want to put the "discount" field on my subform as it would be on every item line and it is used only rarely because 90% of the pricing are bases on "cost plus".
I am new to MS access. I have to delete records from the 2 tables, when the parent record gets deleted. I have a delete button in my form wherein the user deletes the particular record from the parent table.
When the delete button is pressed, the parent record gets deleted from the table. But I need to write a after delete trigger on the parent table to be able to delete the relevant records from the other two child tables, based on the current parent id.
what code should I write ? and should I locate the records in the before delete trigger and then write the code to delete the child record in after delete trigger ?
How I would accomplish the following scenario in Access 2010. I have created a data base for a funeral home. One of my tables includes the date of death of the individual (DOD) (i.e. 04/16/2014). From that date I want to trigger a reminder to follow up with a family letter 6 months from that date. Would I do this with a macro or would I do this with VBA Script?
assignment_num field: 1001, 1002, 1003, 1004, 1005 project_num field: 20,20,15,16,15 employee_name field: tom peter, tom peter, tom peter, julie, sally
What I want is to display the employee name with 2 projects or more...
What i have done? I've done a group by and then count project_num field.. I also added a condition whereby the countofproject_num > 1.. everything went well except that the countofproject_num display 3 instead 2..
I'm fairly new to Access and I'd appreciate some help. I've built a form with buttons to open new forms for that specific record (based on queries as all the data is held in a single table). This works fine until I try to add new records. At the moment the only way I can make this work is to add the new record, shut the original form before re-opening it and proceeding on to the other sections (via the buttons I mentioned).
If anyone could tell me how to get Access to save the record before it opens the other forms I'd really appreciate it.