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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

acces form

Status
Not open for further replies.

josjansen

Programmer
Nov 28, 2001
2
NL
hello,

I'm working on a form wich is linked to a database. In the form i have a combobox wich contends users. next to the combobox i have a butten where users can be ad. when i press the buttom I can ad a user.....(i can see the user in the table....) but in the combo box i don't see the user.......i think i have to put a query with something like update in it onto the table.....WHO CAN HELP ME???
 
If your combobox is based on a query, after you add the user to the table, you have to do a refresh on the query. Terry M. Hoey
 
Going off Terry's suggestion, just place this code at the end of the code on your button (If you don't know how to do that, please ask!):

DoCmd.Requery ("[NameOfComboBox]")

Kyle
 
thank you kyle,

but how can i do that excectly?
i'm not that good with visual Basic....

 
Go into design view of the form. Right click on the button and select "Properties". On the Properties form, go to the "Event" tab (it's the one in the middle). On the Event tab, go to the row with "[Event Proceedure]" in it and click to the right of the box on the button with three dots on it (e.g. "..."). This will open up your code for that button. It should look like this:

Private Sub [ButtonName]_Click()

[A BUNCH OF CODE HERE]

Exit_[ButtonName]_Click:
Exit Function

Err_[ButtonName]_Click:
MsgBox Err.Description
Resume Exit_[ButtonName]_Click

End Sub

Place the line of code I gave you right above the line:

"Exit_[ButtonName]_Click:"

Like this:

Private Sub [ButtonName]_Click()

[A BUNCH OF CODE HERE]

DoCmd.Requery ("[NameOfComboBox]")

Exit_[ButtonName]_Click:
Exit Function

Err_[ButtonName]_Click:
MsgBox Err.Description
Resume Exit_[ButtonName]_Click

End Sub

If this section:

Exit_[ButtonName]_Click:
Exit Function

Err_[ButtonName]_Click:
MsgBox Err.Description
Resume Exit_[ButtonName]_Click


isn't there (it's for error handling), then make your code look like this:

Private Sub [ButtonName]_Click()

[A BUNCH OF CODE HERE]

DoCmd.Requery ("[NameOfComboBox]")

End Sub

Kyle ::)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top