Override Event With Function Key

Nov 26, 2005

I am attempting to duplicate a feature of some software I use in my office. Been pretty easy so far because this software is built on Access. So here it is...... I have fields with names, job names in this case. Call it "JobDescription" MOST times I will want proper case, so I put ........

Private Sub JobDescription_AfterUpdate()
[JobDescription] = StrConv([JobDescription], vbProperCase)
End Sub

That works fine. But there are times you want to override this code.... The program I am imitating does this by using the "F10" key to move to the next field instead of the tab key. My question is what code to put on the F10 key to skip the "vbProperCase" code??

View Replies


ADVERTISEMENT

How To Appear Every Single Date With Event When Using Between Function In Query

Dec 8, 2012

I've been using between function with two dates in query and also have put event. There is no mater to display it's event at the start and end date, but if the different date more than one day, for example:

Query 1:
Start Date
End Date
Event
Amount Days

24/04/2012
27/04/2012
Leadership Course
4

the report only display the first and last date with it's event but not display date to 2, 3 and 4. While actually what I want to do in the query when I key in even at the start and end date, the result in a report should display every single date with it's event automatically.

View 1 Replies View Related

Modules & VBA :: Function Returning Max Value - Button Click Event

Dec 8, 2014

I have a table EmployeeInfo containing three fields

EmployeeId
Name
FatherName

I have created form for this table.

I do not want to use autonumber for employeeid for some reasons. I want to place a button along employeeid test box on form.

User will click on the button it will get max employee id from employeeinfo table and add 1 and copy it into employee id text box.

What will be the code for button click event.

View 2 Replies View Related

Modules & VBA :: Error (Invalid Use Of Null) In A Function Called From A Form Current Event

Nov 18, 2013

I am struggling trying to execute a function inside a Form_current event to display some stats.

The Function is this:

Code:
Function FlightsByAircraft(Aircraft As Long) As Long
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim str As String
str = "SELECT * FROM tblFlights WHERE AircraftID = " & Aircraft

[Code] ....

The code for the Form_Current event is this:

Private Sub Form_Current()
txtStats1 = FlightsByAircraft(Me.AircraftID)

Very simple. Well, the problem is when I move to a new record, a error message comes up: "Run-time error '94' - Invalid use of Null". It is because the AircraftID is not populated at that time. I tried to insert in the function code something like that:

Code:
If IsNull(Aircraft) then
exit function
else
.... (the DAO.Recordset code)

but it doesn't work.

View 8 Replies View Related

Override AutoNumber

Nov 9, 2006

Hi all.

I have inherited a database which contains a table of tasks and where the TaskID is an autonumber. Quite a bit of code has been written that refers to specific values but unfortunately one of those is not contained within the table (for background the reference is 10 and where the current value is now 1683).
So, I want to add TaskID 10 but of course I cant be specific about that value. If I change the field to be just a number, I can add the record but then of course Access won't allow me to change it back to AutoNumber.

Any ideas?

Regards,

Gordon

View 5 Replies View Related

Override A Calculation

Dec 6, 2006

i have a database form with a field called commitment fee

in that field is a calculation

=-IIf([Type of finance]="Term Loan",([Total amount requested]*0.015),-([Total amount requested]*0.01))

But sometimes i want to be able to override this and input a different value like 0.00 if the amount has been paid.

any ideas what the code would be for this

regards
chris

View 1 Replies View Related

Override Required Fields

Aug 30, 2007

Well guys, I don't know if this is possible or not, but maybe someone can guide me in the right path.

I have a data entry form that several employees use. I have certain required fields that are set on the form level. I have couple employees that I would like to have the ability to override these fields. I was thinking like using F10 key or other key combinations that will allow them to override the required fields in order to save the record.

Is this something realistic that I can accomplish in access, and if so, does anyone have a sample that can help me with this task? Thanks to all.

View 8 Replies View Related

Override Max Width In Reports

Jan 27, 2005

I have a report that i need to extend past the 22" margins currently allowed but have not been able to find a way to reset this value I would require at least double the width. Any suggestions.

View 8 Replies View Related

Allow A User To Override A Calulated Field

Dec 19, 2006

Hi all

i have a field called commitment fee and it has a calculation of
=-IIf([Type of finance]="Term Loan",-([Total amount requested]*0.015),-([Total amount requested]*0.01))

but i want to allow a user to enter a manual amount of money into the field how do i do this.

regards
chris

View 1 Replies View Related

Override Form Allow Edits With Code??

Oct 20, 2004

Greeting,
I am still struggling with my sub-form.
Have managed to prevent edit by using the form properties.
However I have some fields which have to be updated after the form has been closed.
I tried putting the following code in the (Before Update Event) of date issued field for instance.

If Me![DateIssued]=Null then
Me![DateIssued].Locked=False
end if

Needless to say this didn't help.

I have some fields which cannot be filled in until a later date.
These are job records so I have date open, Technician name date completed plus a whole herd of other stuff which has to be filled in as the job progresses.

Any help will be most appreciated,
Brian.
Zimbabwe

View 6 Replies View Related

Forms :: Override Default Date Value

Jun 6, 2013

I am developing a customers and orders database for a coffee sales company. I have, of course, a tblOrders that contains the fields 'OrderDate' and 'CallBackDate'. The 'CallBackDate', in most cases, should be 14 days from the 'OrderDate' and self-populate as a default value based on the 'OrderDate'. No problem with the concept there.

I originally wrote the following expression as the control source of the 'CallBackDate':[OrderDate]+14

Yes, works beautifully, populates field just as it should. However, if, for some reason, they want the 'CallBackDate' to be more than 14 days, you can't override and type in your own date.

I have also tried making the control source the 'CallBackDate' field and the default value [OrderDate]+14, but then it doesn't default, only leaves the field open for manual entry. I need to be able to somehow do this within Access. Text fields will allow you to override a default value.

View 3 Replies View Related

Modules & VBA :: Ignore / Override Form Ribbon Created For Users

Jan 27, 2014

I have created a ribbon for the users on all forms, and named that ribbon on each form. While I can bypass the Main ribbon (hiding backstage and most other tabs) by holding the shift key on open, the minute I open a form I am stuck with the very limited form ribbon I've named. Is there a programmatic way I can ignore this call, either when holding the shift key or some other avenue?

View 14 Replies View Related

Forms :: Make Command Button Override Required Fields Focus?

Sep 18, 2014

I am using code like this to give warning messages and pass on focus to boxes only when things are selected.

Private Sub TextBox2_Exit(Cancel As Integer)
If IsNull(Me.TextBox2) Then
MsgBox "TextBox2 cannot be left blank"
Cancel = True
Else
ComboBox1.SetFocus
End If
End Sub

I do this for a series of required fields in order.

However, I also want a command button that is 'Exit without Saving' that should be clickable at any time, but of course when focus is controlled in my required fields sequence, it can't be clicked. How can I separate this button?

View 14 Replies View Related

Modules & VBA :: Creating A Function That Counts Records And Use That Function In A Query

Dec 11, 2013

So basically I need making a function that will count the number of records from another table/query based on a field from the current query.

View 2 Replies View Related

Forms :: SUM Function Produces Error From Calculated Function

Jan 30, 2014

I have a project at hand and it's been a predecessor of mine and client has asked me to do some work on it and extend functionality - but I have not really delved into Access before and I have had to worked my way through to this final snag :/

The Main Form has one sub form. This sub form allows the user to add multiple order items i.e. qty, stock, description from records within the system - fairly straight forward.At the last column of each row is the sub total of those particular items i.e.

Qty Unit | Item ID | Total
-----------------------
2 | 1234 | 80.00
------------------------
1 | 43526 | 20.00
------------------------
> | |

So the total is a function of =[Qty Unit] * [Unit Price].Then in the Footer of this SubForm is the Sub Total

=SUM([Qty Unit] * [Unit Price])

All fine and well..... However, the additional functionality kicks in.

Lets add the additional customer_id from the Main Form. Each Item bought is dependent on the customer_id i.e. they get special prices depending on who they are.So a New table is made which has the Item ID and SpecialPriceID (of a table to define as a specialPrice) and the Price linked to this Item and Special Price category. So say that there are two groups of users "wholesale" and "nonwholesale" these would be SP_1 and SP_2 and each client is defined either one of these, and each stock item has a Price for each SP_1 and SP_2. Hopefully I've explained myself there.

Back to the SubForm. So now the Total needs to calculated differently with needed the external customer_id from the Main Form.

Code:

Function CalculateSpecialPrice(ItemID As String, CustomerID As String, Unit As Integer)
Dim SPSelect As String
SPSelect = "SELECT Price FROM [Items_SpecialPrices] WHERE"
SPSelect = SPSelect & " ItemID = '" & ItemID
SPSelect = SPSelect & "' AND SpecialPriceID = (SELECT SpecialPriceID FROM Customers WHERE customer_id = " & CustomerID & ") "

[code]....

its the sub total I just keep on getting #Error on. I have even watched (using alerts) that the correct return variable is the same as the individual rows. This is the equation I used for the SubTotal within the footer.

=SUM(CalculateSpecialPrice([Item ID], [Form]![FormName]![CustomerID], [Qty Unit]))
#Error

View 2 Replies View Related

Date Function/need Time Function

Jun 9, 2005

We have a date function that converts a text date format. Can someone help me with time function to do the same thing? We want military time. The field is like this now: txt fields.
160037
213137
224356
235716
235800
12341
21708
22732
Here is the date function we use:
Function f2Date(strDateOld As String)
Dim strDate As String, strMonth As String, strYear As String
strMonth = Mid(strDateOld, 5, 2)
strDate = Right(strDateOld, 2)
strYear = Left(strDateOld, 4)
f2Date = strMonth & "-" & strDate & "-" & strYear
f2Date = CDate(f2Date)
f2Date = Format(f2Date, "mmmm d yyyy")
End Function

View 9 Replies View Related

Now Function To Convert To Date Function

May 25, 2006

Hi all,

I need a little help. In my DB, I have a command button set up (I was tired of typing in dates) for date, but I used the Now function, which also gives me the time.

Now I have over 3000 subrecords of the main ones. I now need to queries transaction for that specific date, but it also retrieves the time.

I tried to go back and change the NOW to DATE in VB, but the code does not run.

How do I change all records that have date and time (using NOW function) and only click that command button to show only the date (mm/dd/yyyy)?

Thanks in advance.

View 1 Replies View Related

A New Event

Oct 28, 2007

Hi


I would like to make an event that occurs when the value in the textbox (unbound) is changed.
Can you please show me how to do it?


Thanks

View 1 Replies View Related

Which Event?

Apr 4, 2005

I have a form that has (among other things):

1) a delete button (to delete a record)
2) a Search Payee box (that lists all payee names)
3) an SSN text box

I have code in the "On Enter" event of the SSN text box that pops up a message box asking which way to format the SSN (regular or as tax id). This works fine when entering a new record.

I just discovered, however, that when I delete a record then this message box comes up as well and I don't want it to. Instead I want to use the code "srchPayee.SetFocus" after a record is deleted to move the cursor/focus to the Search Payee box so that the SSN message box does not invoke.

I've tried putting the "srchPayee.SetFocus" in events on the form and also on the delete button, but no matter what I do the SSN message box still pops up after the record is deleted. Which event can I put this code in so that after deleting the record the focus moves to the Search Payee box and the SSN message does not appear?

Thanks!
Laurie

View 9 Replies View Related

Which Event Should I Use?

May 20, 2005

Form1 has a sub form, Form2, which have a tab control with a number of tabs. One of them, Tab4, includes a sub form, Form3.

I have an SQL statement that I want to run (using DoCmd.RunSQL) when Form3 is shown on screen the first time, e.g. when Tab4 activates. I've tried OnClick for Tab4, OnActivate for both Form3 and Tab4 along with a dozen other events with no result. Maybe the problem is that the tab control is also in a subform?

Any suggestions?

View 2 Replies View Related

Which Event?

Jun 3, 2005

I have a combo box with 'yes' and 'no' as options. The default is 'no'. When a user changes it to 'yes', I need to make several text boxes visible on the form. Q. Would it be better to user the OnChange or AfterUpdate event and why?

View 2 Replies View Related

Help With Event Procedure

Apr 11, 2006

Can someone help? I am working on an event database (based on Microsoft 2003 event database template). At present when I register attendees, I can preview an invoice which is generated based on the information I have entered.

I have set up another option to preview a Letter of Confirmation based on this same principal. As I am "Visually Basic" challenged, I simply 'copied & pasted' the event procedure and made the changes as needed to ensure the correct report was opened (ie not the Invoice report but Confirmation Letter report).

However, when I click the button to open preview the letter, the "Print Invoice" box also opens up (as it does when previewing the invoice). I don't want this box to open as I don't need to enter any details.

Can someone please have a look at my VBA event below to see what I would need to delete to stop the "Print Invoice" box from popping up.

Private Sub LOC_Click()
On Error GoTo Err_ConfirmationLetter_Click
If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter attendee and registration information before previewing the Confirmation Letter."
Else
DoCmd.OpenReport "ConfirmationLetter", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID]
End If

Exit_ConfirmationLetter_Click:
Exit Sub

Err_ConfirmationLetter_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_ConfirmationLetter_Click
End Sub


Many thanks for any help.
Kath Price
Auckland, New Zealand

PS - Below is the original 'Preview Invoice' event that I copied:
Private Sub PreviewInvoice_Click()
On Error GoTo Err_PreviewInvoice_Click
If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter attendee and registration information before previewing the invoice."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "Invoice", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID]
End If

Exit_PreviewInvoice_Click:
Exit Sub

Err_PreviewInvoice_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_PreviewInvoice_Click
End Sub

View 2 Replies View Related

Need Help To Detect Event

Aug 19, 2005

Hello,
In an empty field how to detect that the RETURN key has been pressed, i don't know hot to differentiate the RETURN KEY and the field exit by clicking the mouse in an other field because in the 2 cases the value of field is set to "", is there a way to test VbKey in a field ?

This because i want to set my field to a default value only when i press RETURN and i don't want the LostFocus or Exit set my field to this default value if nothing has been typed in my field.
(I must precise that for some reasons in my form the KeyPreview is set to TRUE.)

Thanks in advance for help.
VINCENT.

View 2 Replies View Related

Where To Put My Event Procedure

Oct 18, 2005

In my database I track a program called Bridge. Once you open bridge you can have anywhere from 1 to 7 "Sessions". Each bridge is assigned a number IE LT175A. If there are mulitple sessions they are numbered LT175A, LT175B, LT175C etc. I have a check box in my database that shows if bridge is installed on that PC. If it is then my section for session numbers are visiable, if bridge is not checked then the session numbers section isn't visiable. I currently have my Event Procedure in the After Update section. My code works because if I unclick on bridge my sessions disappears. However when I go to the next record if bridge is checked then my sessions are visiable but on the next record where it isn't checked it still displays the session section. So it isn't adjusting itself from record to record. Does my code need to go someplace else or am I doing something else wrong?
Here is the code I have:(and it's under After Update)

Private Sub Bridge_AfterUpdate()

If Me.Bridge = False Then
Me.BridgeSession_1.Visible = False
Me.BridgeSession_2.Visible = False
Me.BridgeSession_3.Visible = False
Me.BridgeSession_4.Visible = False
Me.BridgeSession_5.Visible = False
Me.BridgeSession_6.Visible = False
Me.BridgeSession_7.Visible = False

ElseIf Me.Bridge = True Then
Me.BridgeSession_1.Visible = True
Me.BridgeSession_2.Visible = True
Me.BridgeSession_3.Visible = True
'Me.BridgeSession_4.Visible = True
'Me.BridgeSession_5.Visible = True
'Me.BridgeSession_6.Visible = True
'Me.BridgeSession_7.Visible = True
End If
End Sub

Thanks,

Rick

View 2 Replies View Related

Car Event | Few Errors

Jun 1, 2006

Hi all,

i have been sick for quite a while,But back on track now.In the past i was building a car event db and would like to finish it.I have checked it out and there seems to be a few errors that i can't remember anything about.

you must have outlook installed otherwise some missing references come up.also there seems to be a problem with the date on the invoice form,the backup section in utilites.

If someone could have a look and point me in the right direction it would be greatly appreciated.

The file is access 2003 format

View 1 Replies View Related

Click Event

Jun 7, 2006

I'm working with a database with employess info in access, When I click on an employees name in a form, I want to fire off another form with there info, what I have now it does nothing.

View 4 Replies View Related







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