Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a combo box in an Access 97 1

Status
Not open for further replies.

Cads

Technical User
Jan 17, 2000
40
GB
I have a combo box in an Access 97 form of people's names which is populated by a stored query derived from a table called 'Caller'. The people, in question, phone into the user. Sometime these people don't give their name and my user wanted a button to choose the 'Not Given' name from the list.

The first time the form is opened the following code works fine and 'Not Given' is displayed. However, when the first instance is saved and the screen clears to record the next caller, the 'Not Given' button does not work - no entry from the combo box is selected. Presumably, the form wants to be refreshed or even requeried but as there are 2 or 3 mandatory fields, Access doesn't like this. Any ideas, please?

Private Sub cmdNotGiven_Click()
Dim varname As Variant
varname = DLookup("[ID]", "Caller", _
"[LastName] = 'Given' And [FirstName] = 'Not'")
Me!Combo56.DefaultValue = varname
Me.Combo56.Requery
End sub

Steve House
shouse@icaew.co.uk
 
Maybe I'm not quite understanding, but why can't you just set the value of the combo box to equal what you want? Such as:

Private Sub cmdNotGiven_Click()

Combo56 = "Not Given"

End sub


ljprodev@yahoo.com
Professional Development
MS Access Applications
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top