Results 1 to 6 of 6

Thread: data entry form

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    23

    Unhappy

    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!!

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    What's the code you're using to do it?
    Harry.

    "From one thing, know ten thousand things."

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    23
    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


  4. #4
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    I kind of meant the code to move the focus
    Harry.

    "From one thing, know ten thousand things."

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    23
    I have used both kepup and keypress
    if keycode/keyascii = 13 then txtInterviewLenght.setfocus, but it never goes to either procedure

  6. #6
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    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
  •  



Click Here to Expand Forum to Full Width