Combo box

C

cho

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
C

cho

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.
 
A

Allen Browne

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue
 
C

cho

Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.
 
A

Allen Browne

If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type 2 lines:
- The first starts with MsgBox, and then you put in quotes whatever message
you want the user to see.
- The second is exactly as I showed you.
 
C

cho

I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

Allen Browne said:
If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type 2 lines:
- The first starts with MsgBox, and then you put in quotes whatever message
you want the user to see.
- The second is exactly as I showed you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.
 
A

Allen Browne

Needs a closing quote at the end of the word Information.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

Allen Browne said:
If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type 2 lines:
- The first starts with MsgBox, and then you put in quotes whatever message
you want the user to see.
- The second is exactly as I showed you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.



Set the Limit To List property of the combo to Yes.

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
C

cho

Yes It works Allen,
And What about this code

IfNotIsNumeric (OK_Quantity.Text) Then
MsgBox "Fill the correct quantity",64,"Information"
OK_Quantity.SetFocus

VB highlights the words "Then".What's wrong

Allen Browne said:
Needs a closing quote at the end of the word Information.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

Allen Browne said:
If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type 2 lines:
- The first starts with MsgBox, and then you put in quotes whatever message
you want the user to see.
- The second is exactly as I showed you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.



Set the Limit To List property of the combo to Yes.

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
A

Allen Browne

Omit the .Text.
Add spaces between your words.
Use the BeforeUpdate event of the control.
Add the line:
Cancel = True
Drop the last line.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
Yes It works Allen,
And What about this code

IfNotIsNumeric (OK_Quantity.Text) Then
MsgBox "Fill the correct quantity",64,"Information"
OK_Quantity.SetFocus

VB highlights the words "Then".What's wrong

Allen Browne said:
Needs a closing quote at the end of the word Information.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type 2
lines:
- The first starts with MsgBox, and then you put in quotes whatever
message
you want the user to see.
- The second is exactly as I showed you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.



Set the Limit To List property of the combo to Yes.

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
C

cho

Sorry again,
How to change the format of message box font.I want a bigger font size.Cause
the font seems too small?

Allen Browne said:
Omit the .Text.
Add spaces between your words.
Use the BeforeUpdate event of the control.
Add the line:
Cancel = True
Drop the last line.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
Yes It works Allen,
And What about this code

IfNotIsNumeric (OK_Quantity.Text) Then
MsgBox "Fill the correct quantity",64,"Information"
OK_Quantity.SetFocus

VB highlights the words "Then".What's wrong

Allen Browne said:
Needs a closing quote at the end of the word Information.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type 2
lines:
- The first starts with MsgBox, and then you put in quotes whatever
message
you want the user to see.
- The second is exactly as I showed you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.



Set the Limit To List property of the combo to Yes.

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
C

cho

Like this?

If Not IsNumeric(OK_Quantity) Then
MsgBox"Fill The Correct Quantity",64,"Informasi"
Cancel = True
OK_Quantity.SetFocus

But It doesn't make a sense

Allen Browne said:
Omit the .Text.
Add spaces between your words.
Use the BeforeUpdate event of the control.
Add the line:
Cancel = True
Drop the last line.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
Yes It works Allen,
And What about this code

IfNotIsNumeric (OK_Quantity.Text) Then
MsgBox "Fill the correct quantity",64,"Information"
OK_Quantity.SetFocus

VB highlights the words "Then".What's wrong

Allen Browne said:
Needs a closing quote at the end of the word Information.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type 2
lines:
- The first starts with MsgBox, and then you put in quotes whatever
message
you want the user to see.
- The second is exactly as I showed you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.



Set the Limit To List property of the combo to Yes.

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
D

Douglas J. Steele

You can't. You'll have to create your own form that looks like a message box
and use it.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


cho said:
Sorry again,
How to change the format of message box font.I want a bigger font
size.Cause
the font seems too small?

Allen Browne said:
Omit the .Text.
Add spaces between your words.
Use the BeforeUpdate event of the control.
Add the line:
Cancel = True
Drop the last line.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
Yes It works Allen,
And What about this code

IfNotIsNumeric (OK_Quantity.Text) Then
MsgBox "Fill the correct quantity",64,"Information"
OK_Quantity.SetFocus

VB highlights the words "Then".What's wrong

Needs a closing quote at the end of the word Information.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type
2
lines:
- The first starts with MsgBox, and then you put in quotes
whatever
message
you want the user to see.
- The second is exactly as I showed you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.



Set the Limit To List property of the combo to Yes.

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
A

Allen Browne

It looks like you need more basic help than we are able to give in the
newsgroups.

You will need to spend some time learning about VBA, and about the Access
events.

Depending how you learn, that might involve buying books, enrolling in a
course, etc.

All the best.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

cho said:
Like this?

If Not IsNumeric(OK_Quantity) Then
MsgBox"Fill The Correct Quantity",64,"Informasi"
Cancel = True
OK_Quantity.SetFocus

But It doesn't make a sense

Allen Browne said:
Omit the .Text.
Add spaces between your words.
Use the BeforeUpdate event of the control.
Add the line:
Cancel = True
Drop the last line.

cho said:
Yes It works Allen,
And What about this code

IfNotIsNumeric (OK_Quantity.Text) Then
MsgBox "Fill the correct quantity",64,"Information"
OK_Quantity.SetFocus

VB highlights the words "Then".What's wrong

Needs a closing quote at the end of the word Information.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

I have tried like this

MsgBox,vbOKOnly,"Information,64,"Check Model Name You have Entered"

Response=acDataErrContinue

But no changing occured.What's wrong

If you set the On Not In List property of the combo to:
[Event Procedure]
and click the Build button (...) beside that,
Access will open the code window for you.

Between the "Private Sub..." and "End Sub" lines, you want to type
2
lines:
- The first starts with MsgBox, and then you put in quotes
whatever
message
you want the user to see.
- The second is exactly as I showed you.

Unfortunately I'm blind about VB.
Would you like to write me this time
and,where the good source to study
VB for a beginners.Thank's for helping me.

Use the Not In List event procedure of the combo.

You can say anything you want with a MsgBox.

Then suppress the built-in message by adding this line:
Response = acDataErrContinue

Thank's Allen,it works but,
I want to change the content of the error essage,
would you like to help me with the code.



Set the Limit To List property of the combo to Yes.

Hi,
I put a combo box in my form as the input data.
How to restricted the input data base to the data
listed in the combo box only,so that if somebody
try to input data which are not listed in combo box,
the form automatically denied to save the record.Thank's
 
Top