Results 1 to 5 of 5

Thread: [RESOLVED] little problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2012
    Posts
    130

    Resolved [RESOLVED] little problem

    hello experts
    I am facing two little problems

    1. when press f8 key a small window loads on the screen asking for enter the customer number
    when press enter button it does not close that small window

    2. when form loads it initialize the transaction id before which may cause a serious problem when the same form loads on the same time on two different computers i want to generate the transaction id at the end of the transaction when make the payments so that there will be no mismatch in the transaction ids

    when press f8 key the window which ask for the customer number when entering the customer number if found from the database records will be display on the location of transaction id caption

    I tired to do so but getting lot of errors i have attached a file which contains the form

    Plz help me in this
    Attached Files Attached Files

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    May 2012
    Posts
    130

    Re: little problem

    any solution? plz help

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2012
    Posts
    130

    Re: little problem

    plz help anyone

  4. #4
    Member sgarv's Avatar
    Join Date
    Jul 2012
    Posts
    34

    Re: little problem

    I had a look at your code and it is somewhat complex. Let me ask you a few questions to try and break down the issues that you are having.

    1. From looking at the form that you sent, I assume that the "window" for the customer number is actually a picture box. If so, can you provide the name of it? I saw various picBoxes for password, quantity, sale type, etc., but did not see any for customer number. I see that you various Keypress events checking for Chr(13). This might have to be changed depending on whether the customer number is entered within a picBox or in in own form.

    2. Which is the code that processes the F8 key? I found the following:

    Case vbKeyF8
    Picture1.Visible = True
    txt(4).SetFocus
    SendKeys "{home}+{end}"
    txt(0).Enabled = False
    Toolbar1.Enabled = False
    lstsale.Enabled = False

    Is this it? What are you trying to accomplish with sendkeys home + end?

    Assuming it is the above code that corresponds tot he customer number window then I see that you are using txt(4). I then looked at the Keypress event for the txt control and see that you do not have a case for Index = 4.

    Also, in the form load event I see that you reinitialize the connection object various times using the variable strConek. If you are querying from the same database you should not reinitialize the connection variable every time. You can initialize it once (set ac = new adodb.connection and ac.open...) then close it so that you app starts with a closed connection.

    Now every time that you have to query the db you do something like this:

    ac.open
    strSQL "select * from..."
    set rs = new adodb.recordset
    rs.open strSQL, ac ...
    ac.close

    You do not have to pass the connect string (strConek) every time you open the connection, just on the first time.

    Also, in the open statement to open the recordset I see that you are passing strConeck (the connection string). Instead you should pass the connection object (ac, as above example).

    Also, as a suggestion, it is best to try to isolate the problem and share the relevant code, not the entire form (which in this case is a lot of code!). People who like to help other generally don't have the time or patience to analyze such a huge amount of code. If possible try to replicate the problem using a simple test app and then publish that code.

    For now I hope that the above is helpful to you. If your problem persists you'll need to explain in more detail what type of incorrect functionality you are getting so that we can break down the code further. Regards, SGarv

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2012
    Posts
    130

    Re: little problem

    yes the same

    Case vbKeyF8
    Picture1.Visible = True
    txt(4).SetFocus
    SendKeys "{home}+{end}"
    txt(0).Enabled = False
    Toolbar1.Enabled = False
    lstsale.Enabled = False

    i only want to closed this when the user enters customer number and press enter and if the customer number found from the database then this picturebox1 should be close and if unable to find from the database then focus on the txt(4)

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