Results 1 to 10 of 10

Thread: combo box problem

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2002
    Posts
    36

    Exclamation combo box problem

    Hi! Guys...

    I created a database application, and in that i have taken a combo box and it's style property to Dropdown List. but when i run the form it gives me an error "Text-read only"...
    I want the user can not type in the combo-box.

    I think u got it ...
    Please help

    Thanks in advance...

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    There has to be more to your problem than what you have stated. Setting the style to Dropdown list so users can't type in it is very common, and works just fine. What is happening to the combo box when you get the error?

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2002
    Posts
    36

    combo box roblem and check the code

    Please see the attachment and Please suggests ur ideas(codes)
    regarding the Project.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Attachment?

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2002
    Posts
    36

    project problem

    see the zip file ...
    Attached Files Attached Files

  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2002
    Posts
    36

    Exclamation project problem

    Hi To All....

    Please tell me that when i download the attachment file with the database(access) and when i opened that file it gives me error that"Unrecognized database".what is the problem...


    1) When i set the style property of combo box to "drop-down list" it gives me an error to "Text-property is read only"
    2)I want the autonumber of serial number text field.Therefore I tried to set the data type of serial number to autonumber in the database design. but when i click the addnew button and suppose I want to cancel the record & when I again press the addnew button the serial number field jumps to another number.

    Currently I have not set the datatype to serial number.
    Please help me regarding this PILOT PROJECT.


    AND ALSO I WANT TO TELL YOU THAT THIS PROJECT IS NOT FOR ANY COMPANY. THIS IS MY COLLEGE ASSIGNMENT

    So please help me and please suggests ur ideas.

    Thanks in advance.

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2002
    Posts
    36

    problem with pilot project

    I want that the user must fill the all fields. How it can be done?I tried with Isnull and Isempty but ...
    please help.

  8. #8
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Chill.


    Take a deep breath..... hold it..... let it out.


    You want a lot of things.
    Lets see.
    Making the user input - and validating the input
    Create a function to take the control then perform a series of tests depending on the optional variables supplied to the function. Tests involve : IsNull, Len(), IsNumeric(), IsDate

    Serial number
    Does the jumping number really matter?
    If not then don't create the record until you've done the validation etc.
    I assume that the serial number is the auto number field, and its only used to link through the tables... so jumping shouldn't matter.

    Drop down
    If you want the user to enter new data, you can't use this. But if you set it to drop down then the user is forced to use only the values you specify in it. Which is good. Mostly.

    I note from the way you have specified the serial number that the controls are bound, which may be one reason for the error messages. Also, with combo boxes check out the Item property, and pass it the ListIndex of the combo box - may give you the text you require.

    Good luck

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  9. #9

    Thread Starter
    Member
    Join Date
    Jan 2002
    Posts
    36

    nervous

    First of all did u download the attachment file...

    I tried by using
    Making the user input - and validating the input

    if not isempty(text1.text) =true then
    msgbox"You have not filled the text1 box.OK"
    else
    msgbox"fine"
    endif

    but it didn't work...
    if there is anything wrong please explain ur code...

    Serial number

    Your point is correct but i want that if the user click the addnew button,the serial number field gets automatically increase by one with respect to previous.But if user want to cancel the record then no problem but if user again click the addnew button the serial number field increases automatically 1.i don't want this...
    I think u understand my question.

    Drop down
    Again i tried to solve my error regarding combo-box problem but i didn't get it.

    So i request u to please download the attachment file and please suggest your code (your guidlines) and please help me..

  10. #10
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    I can't run vb here at work and I'm not online at home.

    Use an over all variable (sub declared) for whether validation is ok or not. Set to true before all the checks and to false if it fails a check.
    The Check
    This is one way (without the Nz function from Access)
    1) set string to ""
    2) assign text to string if its not null (ie so it has something in it)
    3) check the length to see if its greater than 0 or not and respond as required
    VB Code:
    1. Dim blnValid as boolean
    2.  
    3. blnValid=True
    4.  
    5. strTemp=""
    6. if Not IsNull(text1.text) then strTemp = text1.text
    7. If Len(strTemp)=0 then
    8.   msgbox"You have not filled the text1 box.OK"
    9.   blnValid=False
    10. else
    11.   msgbox"fine"
    12. endif
    13.  
    14. '---- other code
    15. '....
    16. '....
    17.  
    18. if Not blnValid then
    19. '---- it failed now leave and don't do anything else
    20.   msgbox "Failed validation"
    21.   exit sub
    22. end if
    23.  
    24. '---- proceed into code for updating



    Your point is correct but i want that if the user click the addnew button,the serial number field gets automatically increase by one with respect to previous
    Problem here is if its a multi user db. Can't be done. However. If you change the auto number to number and then run a query to retrieve the max number so far and add one to it you get your new id. This doesn't work too well in multi users because of the time taken to get the number and create the new record with that number... Up to you.



    If you select an item from the combo box the listindex is changed from -1 to the row number of the selected item. So check if the ListIndex is -1 or not to see whether something was selected.
    It might be Combobox.ItemData(Combobox.ListIndex) to get the displayed text.

    Have an experiment.

    Keep calm, if you get all worreid etc you can think t herefore can't fix. Since it is a project, last hope would be to request some guidance from the tutor. They should be able to point out sections in the book you've studied from to look at.

    Regards

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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