Help With The "On Key Press" Function

May 6, 2005

I am trying to get an action to take place when the "enter" key is pressed. The code I have does not recognize the "enter" key. When I put in the "a" key the code works. Can someone please look at the code below and tell me what I need to put in place of "a" to get the code to work with "enter" key??? I have tried ("CR", "013", "enter").

Private Sub PickupBy_KeyPress(KeyAscii As Integer)
If KeyAscii <> Asc("a") Then GoTo Exit_PickupBy_KeyPress

On Error GoTo Err_PickupBy_KeyPress

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "By_Dealer_Standby_Results"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_PickupBy_KeyPress:
Exit Sub

Err_PickupBy_KeyPress:
MsgBox Err.Description
Resume Exit_PickupBy_KeyPress
End Sub

View Replies


ADVERTISEMENT

Capturing F11 Press, Possible?

Sep 18, 2007

Hi,
I've read a few posts regarding removing the facility of the F11, open Db window, but is there a way to capture if someone presses F11?
I have a few people (users) who think they know a thing or two about Access and I'd like to know if/ when they're accessing the Db window.

I was hoping for the ASCI code or similar for the F11 key!?
Thanks
Matt

View 4 Replies View Related

Button Press

Aug 27, 2006

How do I make a botton on a form open a report when pressed?

thanks

View 10 Replies View Related

Event Procedure On Key Press

Jun 7, 2006

Does this happen on any key or can I specify the return key. If so how?

Thanks

View 2 Replies View Related

General :: On Key Press Event

Nov 19, 2013

I have a code on my list

Code:
Private Sub Lista0_KeyPress(KeyAscii As Integer)
Dim strSQL As String
Dim db As DAO.Database
If KeyAscii = 50 Then
strSQL = "UPDATE tblZlecenia SET Priorytet = " & "7" & " WHERE ID_Zlecenia='" & Me.Lista0 & "'"
CurrentDb.Execute strSQL
End If
End Sub

When I press button "2" on my keyboard, my code is working (it's ok) but except this, changing selection on my list, to position where bound column starting from "2" character. What I should do, to not change possition on my list?

View 3 Replies View Related

Sort Listbox Via A To Z Button Press

May 29, 2005

Hi,
I need help with listbox problem:
I made a listbox contains peoples name from A to Z.
I want to sort it via A to Z button press.
It's similar with customer phone list form in Northwind.mdb sample,
due to my limited knowledge, I can't replicate it using listbox.

Any sample to do this?

Thankyou.

Gunawan.

View 7 Replies View Related

Automated Press Adverts - Via The Use Of A Database?

Jan 31, 2006

Hi I really hope some one can help me out here.

Here the outline of the situation. Every Friday evening I get sent a load of press adverts, which I have to put on the Intranet. This will involve detaching the ads, renaming them, adding them to the site with the Name of the paper, the date, and the organisation they belong to. What I want to know is if there is a more automated way of doing this. I was thinking weather I could detach and drop the ads into a folder and get a Access database connection to the press ads page. Which in-turn would allow me to insert the ads for the last seven days, yet keep a account of all ads which can be a called upon, via perhaps the use of a search function. This is just one idea I have had, are there any other ways I could make this mundane job easier?..

http://i24.photobucket.com/albums/c42/budgy/adverts.gif

All your suggestions and feedback will be much appreciated.

Thanks in Advance

Budgy

View 1 Replies View Related

Keyascii 13 Not Triggering On The Return Key Press

Jul 14, 2005

As above, I've noticed that it will only trigger if there are no textboxes on the form with a higher tab index than the control the keyascii is set for. Any ideas why, or what I'm doing wrong?

I've found this a lot and never bothered trying to find a solution till now. :p

Gareth

View 1 Replies View Related

Queries :: Don't Include Certain Records At Press Of A Button

May 7, 2015

if its possible to have a button that after clicking it, it doesn't show certain records. Reason being I have a "shows" for each month on our personal site and amazon, and we've been selling on those for about 2 years, and I have a "show" for each month. But, that quickly clutters up the list box. Any way to create a button the (after typing in the name) it doesnt show only those record(s)?

View 2 Replies View Related

Button Press Enters A (calculated) Figure On Form?

Jul 5, 2005

I'm sure this is really simple... apologies, but a search hasn't thrown up any clues.

I have a table with Invoice Value, and Commission Value in it. On the associated form I enter the Invoice Value, and also the Commisison value [which 99% of the time is set at 20%.

I am trying to make a button which, when pressed, enters the calculated commission in the form field (and underlying table) - I realise this could be in the 'On Click' property on the form, but in VBA I am after something like.

Private Sub btnCommCalc_Click()
tblSales.Commission = tblSales.Invoice * 0.2
End Sub

Could someone help me with the syntax? (I can then move on to using a variable, rather than hard-wiring the 20% ;-)

Many thanks

View 8 Replies View Related

Modules & VBA :: When Press Space Key On Keyboard It Will Exit From Form

Jan 13, 2015

i want that when i press the space key on my keyboard oi will exit from the form. i searched on the interne t but i couldn't find the proper one. I don't know exactly what i have to write in vba.

View 2 Replies View Related

Forms :: Press Enter After Password Entry To Gain Access

Aug 16, 2014

what I have is a password entry popup, it's very simple and there is only one password, so it's coded into the form.There is an unbound text box for the password, set with the password input mask.An OK button and an Exit button.The OK button has this code on the 'On Click'

Code:
Private Sub cmdOK_Click()
If IsNull(passwordentry) Then
passwordentry = "*"
End If

[code]...

Now what I want it to do is automatically move to the OK button when the correct password is entered, so that you can just hit Enter.Currently you either have to press the OK button with your mouse, or hit Enter to move to the OK button and then press Enter again to activate it.

View 4 Replies View Related

Modules & VBA :: Command Button Press Multiple Times Based On Value In Text Box

Jul 23, 2015

Is there any way to press a command button a certain amount of times based on a value in a text box.

i.e.

text box value = 5

button gets pressed 5 times with one click...

View 14 Replies View Related

Forms :: Cannot View Added Records When Press Navigate Buttons In Form

Apr 12, 2013

I can add record successfully... but can't view it accordingly when I press navigate buttons in the form...

Database is attached ....

View 10 Replies View Related

Code For When Press A Button It Refreshes And Clears Out Certain Text Boxes In Form

Dec 16, 2011

Is there a code for when I press a button it refreshes and clears out certain text boxes in my form?

View 1 Replies View Related

Modules & VBA :: Select Item And Press EDIT Button To Make Changes In Listbox1 Values

Jun 4, 2014

In the form1 , I have a listbox1 with 2 columns. The values get added in the listbox using vba. Now I want to Edit the listbox values in case user enters something wrong. So when the user selects a listbox item and then EDIT button then form2 gets opened. And the textbox1 of it stores column1 of listbox1 value and textbox2 stores column 2 of listbox1 value. So the user canb make changes in the textbox values and then press SAVE button . Now I want the code that will make those changes in listbox1 of form1 and unload form2 then.

View 2 Replies View Related

Queries :: Press A Button And Run A Macro / Append Query To Add A Single Summary Record To Another Table

Aug 2, 2013

I have a query run that gives me a list of records that I view on a continuos form. What I want is to press a button and run a macro/Append Query to add a Single Summary record to another table.

For example my query spits out this data

Part # Quantity Serial Number
GO2 1 123
GO2 2 456
GO2 2 789

What I'm looking to get is

Part Number Total Quantity Serial Number 1 Serial Number 2 ..
GO2 5 123 456

I'm stuck on a couple of things.

1. Getting a new single row to append.
2. Getting Serial Numbers from several records to save on to a single record.

View 4 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

Function

Aug 1, 2005

Is there any function that can convert either a True, False, "Yes", "No" or Null value.... to a yes/no (check box) data type?

What I want to do is create a make table query. I would like to add a checkbox field from the query. So if there was a function that could convert a data type to a Yes/No checkbox, this would be very helpful...

To give you and idea of what I'm talking about...and how I want to use this... If I am making a table from a query and I want to add a number field, but leave it empty for the time being, what I can do is make a new field in the query maybe call it "Number1". What I would do is Add this as a field in my make table query:

Number1: Cint("")


This will add a blank field that is formatted as a number field when I run the make table query.

So using the same logic, I'd like to make a blank (or unchecked) Yes/No check box field when I run my make table query.

Anyway...that's what I'm hoping for.... I hope someone can help!

Gary

View 10 Replies View Related

Function Isn't Available

Nov 3, 2005

I'm having a problem getting a form to open. I'm using access 97 on on XP machine and whan I open my database I get Function isn't available in expressions in query expression '[Case Types]![theName]&"-"&Format([SourceDocs]![CaseNumber]&"","00")&"-"&Format([SourceDocs]![CaseYear]&"","00")'.

This database works fine on a Windows 2000 machine running Access 97 but none of the XP machines will open it.

Any suggestions?

Thanks,
Rick

View 8 Replies View Related

CHR() Function Not Available

Nov 10, 2006

I have a database in which I am designing a report which includes a name/address block. I am surprised to find that the report does not recognise the Chr() function in the text box control source string "=[Organisation] & Chr(13) & Chr(10) & [Address]..."; designed to insert a CRLF between the contents of the named fields.

I know the syntax is correct because I've checked by using the expression builder to replicate the code. (Expression builder includes the Chr() function, as expected.)

The interesting thing is that the function is recognised in other databases used on the same machine, both those created remotely and locally.

Anyone know what could be going wrong?

Stuart

View 7 Replies View Related

Function Is Not Available

Sep 4, 2005

I am using a crosstab query to gather info from a table. I am using the Format [DateAppt], "mmm". The query ran successfully before but I now get the error "Function is not abailable in expression in query expression 'Format ([DateAppt], "mmm")'. This is used for column headings in a report that gives results by month.

I am using Microsft Office 2000 Premium with XP Professional operating system.

I used the original disk to repair Office thinking that the function was missing from the function library but to no avail.

Does anyone know how to restore this function?

Thank you,
Jack

View 1 Replies View Related

Help With IIF Function

Sep 29, 2005

Just wonder if anyone could give me some help on an IIF function used in my query:

I have a table which has numerous “W” codes, the charging for an order does not occur if it has a W12 or a W14 code and has no “[Authorising Name]” BUT does however charge if the weight of the order is over 100kg


IIf([WCode]="W12" Or [WCode]="W14",IIf([Authorising Name]="",0,[charge], IFF ([weight]>99,[charge],0)))

I can get this working for a single W code but not for the 2 OR I can get it working for both Codes but then the weight side doesn’t.

I have tried all combinations of <> = < etc etc but still no luck., I think I need another OR but no matter where I put it I hit problems either with the function or the result.

Another small issue, my [authorising Name] field can appear to be empty, but in the field are spaces what is the best way for ensuring I capture both empty and theses space records ?

Thanks in advance

View 4 Replies View Related







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