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.
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?
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
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.
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...
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..
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:
Dim blnValid as boolean
blnValid=True
strTemp=""
if Not IsNull(text1.text) then strTemp = text1.text
If Len(strTemp)=0 then
msgbox"You have not filled the text1 box.OK"
blnValid=False
else
msgbox"fine"
endif
'---- other code
'....
'....
if Not blnValid then
'---- it failed now leave and don't do anything else
msgbox "Failed validation"
exit sub
end if
'---- 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.
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...