Modules & VBA :: Button On Form Which Calls Module To Show Calendar Form
Sep 11, 2014
I have a button on a form which calls a module to show a calendar form. The user picks date and time, and saves it. The calendar form closes and adds the date and time to a text box on the initial form.I want to save the record so that the underlying table/query is updated, but it's not working. The record is not saved until the initial form is closed.Here's the form vba...
Code:
Option Compare Database
Option Explicit
Private blnFlag As Boolean, blnSaveIt As Boolean
Private Sub btnDelete_Click()
On Error GoTo Err_btnDelete_Click
I have this code below that is working however the calculation are updating on my form late.
Basically, I have some calculation that are performed on a "After Update" event on some controls on my form. I wanted it to do the calculation after I update the control on the form.
The code is in a module and I just call the function after update on the control But the form is not updating when I change the value in a field. I have to change the field again for it to update.
Control
Code: Call GeraAuditCalc DoCmd.RefreshRecord
Function
Code: Function GeraAuditCalc() Dim fHrs As Double Dim Ttl As Double Dim Ttl1 As Double Dim Ttl2 As Double
I'm wondering how other members here make decisions whether they want to place codes behind form or use a standard module instead.
I understand there is a performance penalty when you add another module (and use it), but am not sure whether one big fat module would be faster than several smaller modules with identical coding.
Furthermore, I know that some members use a hidden form to deal with startup and shutdown processing. Sometimes the processing has nothing to do with forms and would make more sense in a standard module, but since the form is already loaded, does it makes more sense to use the module behind the form than calling a function in a separate standard module to execute the needed code?
I am trying to create a customizable report that would allow the users to choose fields. I have a pretty common code that I found online and adapted it, but it fails on the first SetReportControl function.
The error reads: Run-time error 2465: Application-defined or object-defined error
Could it be something as simple as an incorrect reference? I have checked multiple times, but I am stumped.
Code: Option Compare Database Option Explicit Sub MakeReport()
[Code].....
This is a trial run, in the end I need to be able to open a report, then adjust the Report controls within 1 or more subreports inside the main report. That is a battle for another day.
I have a list of companies that need to return paperwork, we are then scanning that paperwork and placing in a directory and listing that it was received in a table in Access. I want the button to view this scanned in item if the qry for that paper work has arrived and the count is >0.
I run a command on a single form that if a qry is >0 it shows the button and I added that to the GotFocus event in the form.
I'm working on the Navigation Form template in Access 2010, which is new to me. It appears that one needs to use the BrowseTo command to open up a form in the built-in subform module. I'm trying to create a couple of buttons where each button opens a form in a different data mode; one in read-only and one in add mode. Here is the syntax I used for read-only:
frmSales is the Sales form I want both of the buttons to open and frmNavigation is the Navigation form. It seems to be ignoring the data mode part at the end however. It only will open in Edit mode. Is there something I'm doing wrong with this command?
Runtime Error 3075? I have attached a copy of my database. I am trying to make a calendar form with the list boxes having two columns. It works fine with the strFieldID and strFieldName but when I try adding the strDone I run into the error.
I am making a calendar form in Access and want it to look like Google Calendar as much as possible. I am wondering if there is a good way to go about setting up the form to allow for multiple appointments scheduled for the same time. Designing the form to be in Week View with half hour blocks has me at 210 text boxes. As far as I can tell, there isn't a way to dynamically add in controls unless you are in design view. However, how many appointments might be scheduled at the same time. I could add in as many text boxes as possible I guess, but that doesn't seem to be very efficient (and the base form is already at 210). Is there anyway to add in controls (such as text box or label) if a new appointment is added at the same time as existing ones?
I have a main form [Job Quote Form 10-2205] and I am trying to add a command button to open up [Job Process Form-MKD] and have the [Job Process Form-MKD] open up and only show the records that match a certain field, in this case what I call "JobTrackNo" in the [Job Process Form-MKD]. (see attached .jpg)
This problem started to happen only recently, namely you will see that the left column under [Job Quote Form 10-2205] is blank, where normally there had been a number of fields to choose from. The fields are all still available, they are just not opening when I try to match two fields.
in the attached form i can select multiple image but my next and back button does not work ,also i want the path to the file shown above.to copy the name from there and paste it in the table,to write remarks.
frmOperations allows the user to assign a manager to an operation by selecting the manager record from a combobox. Occasionally the user may need to setup a new Manager record if one hasn't been setup already. In this case there is a "New" "button" (it's actually a label with an on click event) that the user can click to open frmManagers and add the new manager record.
The code to open frmManagers is:
Private Sub lblNewManager_Click() DoCmd.OpenForm "frmManagers", acNormal, , , acFormAdd, acDialog Forms!frmManagers!cboMoveTo.Visible = False Forms!frmManagers!lblManagers.Visible = True End Sub
Once frmManagers is open the user creates the new Manager record and then closes the form using a similar label with an on click event:
Code: Private Sub lblClose_Click() DoCmd.Close acForm, "frmManagers", acSaveNo End Sub
frmMangers also has an OnClose event that will refresh any comboboxes on other forms that refer to tblManagers to make sure that new Manager records will be available immediately for the user to choose from:
Code: Private Sub Form_Close() If CurrentProject.AllForms("frmPlants").IsLoaded Then Forms!frmPlants!cboPlantManager.Requery Forms!frmPlants!cboQCManager.Requery
[Code] .....
So the problem comes when the user clicks the Close label (acting like a button) on the frmManagers. The code successfully closes the form and the on close event successfully refreshes any comboboxes on forms that may be open, but then for some reason it attempts to run again or perhaps continue running the onClick event that opens frmManagers. Since the form is already closed it gets hung up on trying to change the visible properties of the controls and the code fails.
I am in Acess2000 and trying to go to put vb in. When I hit the code icon, I get the message: "name of db" failed to create the VB module '|'.
Is anyone familiar with this message and what do I need to do. I just added this form, and in the other forms that have vb code already, I can get to them okay.
Is the calling Form name or the event handler's sub name available in called module? I need it in order to determine the form's name as in [Forms]!someformname!some control.
So I have a form which is showing the current record and you can scroll through these and make modifications to them from the form as opposed to using a table.
The form has the following fields populated from the main table
Customer name (Can appear more than once) Status Date Servers Positions
In addition it has several buttons for next record, previous record, first & last record, new record, delete record and update record.On this form i have a text box that i want to be able to use to search for a record using the customer name when you press the search button associated with it. I've got some code and it is mostly working but it seems to be moving the text entry cursor to the date box of the record for some reason.
What I want it to do is take the text from the search box and find it and move the form to that record.
Code: Private Sub btn_cstmr_srch_DblClick(Cancel As Integer) On Error GoTo HandleError Dim strFindWhat As String strFindWhat = Me.txt_cust_search.Value
You know, when I create a new form and add a button to it. Then I add a new module and entered a public Sub in it. Once I switch back to the new form, I typed this below..
Code:Dim sTest as basTest
I noticed there is no "basTest" in the intellisense. Why? I kept getting a compiler error saying "A module is not a valid type". What do I need to do to fix that? I'm at loss on what's the problem is.
I basically want to Loop through a query (or if not possible trough a table) and show the results in my form. For each record in the table I am doing additional checks when loading the form and showing that result accordingly. I do not want to do these checks in additional queries - I think it is more efficient doing it in the form directly. Here is the code I have:
Dim dbsSR As DAO.Database Dim rstValQry As DAO.Recordset Set dbsSR = CurrentDb Set rstValQry = dbsSR.OpenRecordset("qry_val_tbl_ind_rec-rev_import") With rstValQry While (Not .EOF)
[Code] ....
The Loop seems to work because in debug it is going through it 3 times (the number of records I have in the query), but the result is always the same - it seems the above code is not checking / refreshing based on the individual query records.
I have three forms - Form1,Form2 and Form3 linked to a navigation form with Navigation buttons. I have separate VBA codes under each Before update event of these forms, Form1,Form2 and Form3 to call a VBA module to track the changes performed by the users(Like an Audit Trail) in specified fields of the forms which will track them to a table.there are control tags in the form properties --> others --> Tag to track the changes in the fields which are defined in the VBA Module.this is the code to call the VBA Module:
Private Sub Form_BeforeUpdate(Cancel As Integer) If Me.NewRecord Then Call AuditChanges("UniqueID", "Part No", "NEW") Else Call AuditChanges("UniqueID", "Part No", "EDIT") End If End Sub
[code]....
The code is working perfect when the forms are run separately.but when they are run from the navigation form by clicking the navigation buttons, the code is not working !!
what would i write in the onclick private sub of my 'btnCancel'.i need it to do a number of things depending on whether there is data entered in the form fields or whether its completely empty, is there is data being entered in some fields and the cancel button is clicked it should ask whether the user wants to lose all current data as a msgbox, or if there is completely no data in any of the fields and the cancel button is clicked it shoud take me make to the main form where the rest of my buttons work, which is "inmode normal"