How To Assign Function Key

Hello,

Can anyone tell me how can I assign F2 function key to open a particular form in MS Access.

I dont want to use mouse click on a button so that a report or form to open.

Regards,

Ashfaque


Post your answer or comment

comments powered by Disqus
Hi All,

I am trying to assign function keys to perform actions on a form and sub form.
On the "frmMainClient" form I have an OnLoad event:

Private Sub Form_Load()
Me.KeyPreview = True
End Sub

and a OnKeyDown event:


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF2
Dim stDocName As String
Dim stLinkCriteria As String

stLinkCriteria = "[account_no]=" & Me![account_no]

stDocName = "frmJobNew"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Case vbKeyF3
Dim stDocName2 As String
Dim stLinkCriteria2 As String

stDocName2 = "frmJobEdit"

stLinkCriteria2 = "[job_no]=" & Me![job_no]
DoCmd.OpenForm stDocName2, , , stLinkCriteria2, acFormEdit
Case vbKeyF4
' Process F4 key events.
Case Else
End Select
End Sub

The "case vbKeyF2" works fine.

The "case vbKeyF3" will not work because I think the subform "frmJob" is not in focus. Can anyone give some advice on how to resolve this problem.

Kind regards

I would like to know how to use the function key like F1 to add new record instead of pressing command button. thanks.

Hi to all,

I am researching on how to use function keys like F1, F2 to F12. Like instead of pressing a button to add record, I can instead use of F5 to add record.

tnx.

i am creating a database and i had created two tables one is holidays and second is departure date.. in the holidays table the primary key is holiday code.
and in the departure date table the primary key is Departure Key and there is also field is Holiday Code. now i had create two tables and then i had insert both the table in one but the problem is this when i am changing the primary key's data of holidays table but the rest field is not changing.. i think its need to assign foreign key but i don't know how to do that can u plz tell me how to insert the foreign key.

i doing my assignment and i am stuck here plz reply me soon so that i can move further..

hello all

i'm new here and found this on search engine.
i developed some application with ms access but when i execute mdb application and press SHIFT key, the application is open up (i can show table,query,form,report,etc)
so how to bypass SHIFT key?
i want secure my application and don't want some one else show my source database

thanks
argo

Hi

I need to know how to run function at any worksheet changes.
I tried to use :

Application.Volatile

Function example()

bla bla...........


End Function

But I getting the error: Invalid outside procedure.

Can you please tell me how to make it works?
When I remove Application.Volatile the function runs but only when I push the run button

Thanks

Dear All,

I have made a small database and used unique text as primary key and so far dB is working fine. I have gone through some other post on this site and that says choosing text as primary key should not be an issue neither the max size of 255 for text is an issue. Irrespective of preferred "Long integer" requirement for a primary key. Anyway, before going to my database at large scale, I want to ensure that this thing does not affect my dB in future.

Now, even I can use the autonumber as my primary key and i do have any problem in understanding generating foreign key in related tables, but I am struggling on how to populate foreign keys automatically. It seems a very basic thing for making a sound database but at the moment it is a big issue for me. Please advise.

I have referred to this link, however, still cannot figure out the right approach to code.

As illustrated in the attachment below, can anyone assist me on how to assign a subform value to a control in the main form ?

Hi,
How to disable ESC key in a form for ms access 2000

hey there experts!

I'm sitting here with my treeview and trying to figure out how I can make a unique key. I keep getting the "Key is unique in collection" message.

I have populated 3 levels in my tree, and the whole tree is based on queries.
To illustrate my problem I'll show you an example of when it fails:

|-John
|-Ferrari|-Color: Yellow|-Ferrari|-Color: BlackIn other words, John is not allowed to have two ferraries in the tree. This is because the keys is named after the name of the node (in this example beeing Ferrari).

So, my question is how I can make keys that allows the tree to contain two ferraries on the second level, and also two cars with the same colour in the third level.

I've also been looking at som examples on how this can be done, and there is one examle that in essence suggest to have a key with "i = i+1" so that each of the nodes get a number.

Here is the code I'm working with:

	Code:
	
Function TreeTilsynshistorikk_Fill()
   Dim strMessage As String
   Dim dbs As DAO.Database
   Dim rst As DAO.Recordset
   Dim intVBMsg As Integer
   Dim strQuery1 As String
   Dim strQuery2 As String
   Dim strQuery3 As String
   Dim nod As Object
   Dim strNode1Text As String
   Dim strNode2Text As String
   Dim strNode3Text As String
   Dim strVisibleText As String
   Dim i As Integer
      
   Set dbs = CurrentDb()
   strQuery1 = "QryTilsInsTree"
   strQuery2 = "QryTilsInsProdTree"
   strQuery3 = "QryTilsInsProdDatoTree"
   i = i + 1
      
With Me![TreeTilsynshistorikk]
      'Fill Level 1
      Set rst = dbs.OpenRecordset(strQuery1, dbOpenForwardOnly)

      Do Until rst.EOF
         strNode1Text = StrConv("Level1" & rst![Initialer], vbLowerCase)
        Set nod = .Nodes.Add(Key:=strNode1Text, Text:=rst![Initialer])
         'Expand the entire node
         nod.Expanded = False
         rst.MoveNext
      Loop
      rst.Close
      
      'Fill Level 2
      Set rst = dbs.OpenRecordset(strQuery2, dbOpenForwardOnly)

      Do Until rst.EOF
         strNode1Text = StrConv("Level1" & rst![Initialer], vbLowerCase)
         strNode2Text = StrConv("Level2" & rst![Navn], vbLowerCase)
         strVisibleText = rst![Navn]

        .Nodes.Add relative:=strNode1Text, relationship:=tvwChild, Key:=strNode2Text, Text:=strVisibleText
          rst.MoveNext
      Loop
      rst.Close
      
'Fill Level 3
       Set rst = dbs.OpenRecordset(strQuery3, dbOpenForwardOnly)

      Do Until rst.EOF
         strNode2Text = StrConv("Level2" & rst![Navn], vbLowerCase)
         strNode3Text = StrConv("Level3" & rst![Dato], vbLowerCase)
         strVisibleText = rst![Dato]
           .Nodes.Add relative:=strNode2Text, relationship:=tvwChild, Key:=strNode3Text, Text:=strVisibleText
          rst.MoveNext
      Loop
      rst.Close
      

   End With
   dbs.Close


End Function



I figured out how to send data to a chart object datasheet. By default the chart is based on A2, B2, C2 & D2 and then three rows of each.

I have 64 data elements that I want to plot in to a histogram (see attached histogram from excell). I have a loop program A1 (or A2) through A64 data. Now how do I get the X-AXIS of the histogram chart assigned to that column of data?

Hello to all,
Little new in Access i would like to know how to use the key to find directly to a record in a table.
ie : i have a table where the primary key (unique) is a date, using VBA i would like to know the instruction to find directly the record 01/06/2004 for exemple.
Thanks in advance.
VINCENT

I may have shot my self in the foot with my previous post. I realise I managed to get into another function more by luck then programming know how. I dont understand how to make functions run and can only just understand a very simple funtion but still could not write one. I need leading by the hand at the moment so would appreciate some help.
If I were to use a command button what code would I attach to it to call the following function?

The funtion gets what ever charectors are on the screen at a given
co-ordinance

Thank you in advance
smiler44


	Code:
	Function GetStringFromScreen(tnsscreen As Object, ypos As Integer, xpos As Integer, length As Integer) As String
' Get a string from screen object given xpos, ypos & length
' If Session Disconnected, (TNS crash) raise error.
On Error GoTo GetStringFromScreen_ERH
If tnsscreen.Parent.Connected = True Then
    GetStringFromScreen = tnsscreen.GetString(ypos, xpos, length)
End If
Exit Function
GetStringFromScreen_ERH:
    Err.Raise numSESSIONDISCONNECTED, Title, strSESSIONDISCONNECTED
    Exit Function
End Function



Hello! I'm trying to assign a number to a set of rows so I can, essentially, create a dual primary key on a table. Below is an example of what I have...

654321 | Course 1
654321 | Course 2
123456 | Course 1
123456 | Course 2
123456 | Course 3
123456 | Course 4
123456 | Course 5

The numbers are just "student numbers" if you will. Something that identifies them. The second column is basically the name of a course. What I would like to do is number each row, but only within the group of that individual.

Example:

1 | 654321 | Course 1
2 | 654321 | Course 2
1 | 123456 | Course 1
2 | 123456 | Course 2
3 | 123456 | Course 3
4 | 123456 | Course 4
5 | 123456 | Course 5

Can I accomplish this?

Hi there,

I am developing a medical patient database for out research group. We have agreed to store numerical values in the table to help running statistics later. however, in the input form, we have to give text options.

For example, I would like to create a form to save maternal medical history. The first field is gestational diabetes. This field can have the numerical values 1, 2 and 3, which would mean:
1: Yes
2: No
3: No data.

Now, I have managed to create a combo box with the Yes/No/No data options, I just don't know how to write a script/code, which would assign the numerical values to the options and save the appropriate number to the appropriate field in the table.

Sorry, if I'm being impossibly amateur

Thanks,
Aron

Hello everyone,

It's my first time in this forum, and I was wondering if somebody can help me out...I have a form wherein I frequentyly use the "Form by Filter" icon on the toolbar as well as the "Apply Filter". Instead of clicking on these icons, can you assign these to a Function key (F1 or any other function key, provided it's first disabled with its original purpose). Any help would be truly appreciated. Thanks.

hi,

I placed 64 color boxes in form.

instead of assigning event procedure for each and every boxes (for example, onclick event), I wish to assign it programmatically by using a loop.

How to do this?

thanks.

Hi, Good morning to everybody in the forum:

1. Got emergency project which require us to build simple database using Access 2010. Let's say the company want to recruit employee - they can come forward using 3 options:

a) By own person - only 1 person at a time
b) Hire by a group of friends - can be more than 1 person at a time
c) Hire by company - can be more than 1 person at a time

So I want to build database to register all the workers that come in for interview, as I understand I need to use foreign key to do the selection (3 options give by drop down menu). But I don't know how to use the syntax... Please help

2. When we choose from 3 options - each represent 3 different sets of field for person/friends/company to key in contact detail:-

a) For each person - we only need to keyin once
b) For a group of friends - we need to key in each friend details
c) For company - we need to register company detail and each worker detail...

So my question is how can we display difference set of form based on selection given?

3. We are thinking of adding subform for each worker - for family details - in datasheet format - so any particular setting need to keep in mind..

That's all...Hope to hear u guy soon..Again thanks ...

Please help...

Hi !

I am a new member of this forum and a newbie in Access. I joined this forum to ask for help.

I have a form that has command buttons for addrecord, first, previous, next and last.

I have no idea on how to solve this but what I want to achieve is when I click the next button, it will only go to the next record but NOT/CREATE to/a the new record. what happens is that when I input new data and click next, it acts as if I add it.

Also I would like to know who to use function key such as F10 such that when I press F10 it will close form or add record.

TIA

To clarify:
i have table with companies (accounts) and a table contacts (people working for the specific company.
Then among this contacts there are contacts - individuals not linked to any account.
Question:
how to relate tables contacts with acounts if some are linked and some not ?
thanks in advance

i know we can filtering a dataset something like this (very simple example):

DataSet ds = new DataSet();

....(after filling ds with a table)

DataRow[] dr1;
string filter1 = "ID = 23";
dr1 = ds.Tables[0].Select(filter1);

I know we can even use keyword 'Like' in a dataset's filter, but I wonder how to use function like 'select distinct ...' to a dataset?

Many thanks for your help!

Hello,

I need help with following: in query I made I have one short date-type field called "CurrentDate". On my PC, default short date format is like this "MM/dd/yyyy".

In my query I have one more field which looks like this "ExtractDate: Left([CurrentDate],2)". This is how it looks like:



Task of this field is to "extract" first wo values of field "CurrentDate". So for example if value of field "CurrentDate" is "07.02.2011" then field "ExtractDate" will show value "07" and that works very good but recently I had to change short format date on my PC to this one "dd/MM/yyyy" so my field "ExtractDate" is now showing value "02".

Im not sure how to write function in query which will "extract" month from this type of date format "dd/MM/yyyy". How to single out value "02" from this type of date "07.02.2011"??

Any help is appreciated and many thanks in advance for prompt replys!

Cheers

Can we program function keys in Access?
For example, I want to use function key like F2, F3 etc, which when pressed,
should write some text lines (like 'My name is..etc') in the active control text box, (may be using sendkeys or any other).

anyone know a way to capture multiple key strokes when a form is open? when a form is open and the user presses a combination of keys at the same time (ie cntrl+j) i want an event to fire. (much like when you hit cntrl+alt+del in windows)

microsoft access 2003


Not finding an answer? Try a Google search.