|
-
Sep 11th, 2000, 08:29 AM
#1
Thread Starter
Junior Member
I have a simple data entry form. I would for the user to be able to use the enter key to tab through the form. I am having trouble with a command button. I can use the enter key to get the focus of the cmd button, but when I hit the enter key again it skips a field(instead of going to fld 2 it goes to fld3) Need help!!
-
Sep 11th, 2000, 08:32 AM
#2
Frenzied Member
What's the code you're using to do it?
Harry.
"From one thing, know ten thousand things."
-
Sep 11th, 2000, 08:41 AM
#3
Thread Starter
Junior Member
Hi Harry
this is the code for the cmd button, at the end i have enabled the textboxes. I als o set the keypreview to true on the form level.
Private Sub cmdNewClient_Click()
Debug.Print "cmdNewClient fired"
Dim Response
Dim MaxID
Dim CLIENT As String
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
'Adds new Client
cn.ConnectionString = deAgency.conAgency.ConnectionString
cn.Open
rs.Open "SELECT MAX (CLIENTID) AS maxi FROM Clients", cn, , adLockReadOnly, 1
rs.MoveFirst
MaxID = rs.Fields("maxi").Value
CLIENT = UCase(cbClient.Text)
deAgency.rsClients.AddNew
deAgency.rsClients.Fields("CLIENTID").Value = MaxID + 1
deAgency.rsClients.Fields("CLIENT").Value = CLIENT
deAgency.rsClients.Update
cbClient.Text = CLIENT
lblClientID.Caption = MaxID + 1
rs.Close
cn.Close
txtInterviewLength.Enabled = True
txtFieldMgmt.Enabled = True
txtMethod.Enabled = True
txtJOBTITLE.Enabled = True
txtIncidence.Enabled = True
txtQualifications.Enabled = True
cmdNewClient.Enabled = False
-
Sep 11th, 2000, 08:44 AM
#4
Frenzied Member
I kind of meant the code to move the focus
Harry.
"From one thing, know ten thousand things."
-
Sep 11th, 2000, 08:51 AM
#5
Thread Starter
Junior Member
I have used both kepup and keypress
if keycode/keyascii = 13 then txtInterviewLenght.setfocus, but it never goes to either procedure
-
Sep 11th, 2000, 09:04 AM
#6
Frenzied Member
Hmm, perhaps the event in which you set the focus is executed before the code in the button - if the text box isn't enabled I don't think it can receive the focus.
Harry.
"From one thing, know ten thousand things."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|