|
-
Jan 4th, 2000, 09:28 PM
#1
Thread Starter
New Member
Hello,
I have a DataCombo box on a form which is retrieving it's items from a Command in my DataEnvironment. The data I am working with on the form is from a recordset I have created programatically using OpenDatabase and OpenRecordset with a SELECT. When adding a record I use the .AddNew and .Update methods on the recordset. My problem is I can not get the DataCombo box to display the updated information after an add or an edit. I have tried a .Requery on the Command in the DataEnvironment, I have tried a .Requery and a .Move(0) on the recordset I am using, I have tried a .ReFill and a .Refresh on the DataCombo box. I have also tried using an Adodc control as the DataSource for the DataCombo box and refreshing that but that did not work either and I would prefer not to have to use an Adodc control. So, fundamentally, I think I need to update the Command in the DataEnvironment which I presume will update the DataCombo. Any suggestions greatfully received.
Thanks in advance.
Tom
-
Jan 4th, 2000, 11:28 PM
#2
Junior Member
After you requery the recordset, reset RowSource property for your Combo Box:
Set DataCombo.RowSource = DE
Regards, Vlad
-
Jan 5th, 2000, 02:00 AM
#3
Junior Member
Tom,
Can you post the code fragment?
Vlad
-
Jan 5th, 2000, 02:21 AM
#4
Guru
Don't waste your time with the data environment, just use the ADO objects. Execute a SQL statement to retrieve the fields and repopulate your combo box. The data environment can be finicky and unpredictable
-
Jan 5th, 2000, 12:50 PM
#5
Thread Starter
New Member
Vlad,
Thanks for your reply, unfortunately this method seems to work in a delayed fashion. If I do an edit then the edit which I did does not appear in the DataCombo box until I do another edit and I can not find the command(s) which make this happen. Thanks very much for your help so far.
Tom
-
Jan 5th, 2000, 06:15 PM
#6
Thread Starter
New Member
Hello both, thanks for your replies, OK here is a code snippet, I hope it is enough:-
' HERE I HAVE SET UP THE NEW RECORD USING
' COMMANDS SUCH AS
' customers!Name=Form2.CustName.Text
' AFTER DOING A customers.Edit or AddNew
customers.Update
customers.Move (0)
Adodc1.Recordset.Requery
Set DataCombo1.RowSource = Adodc1
DataCombo1.ReFill
DataCombo1.Refresh
Using the Adodc certainly seems easier, however the changes only appear in the DataCombo box the next time I do an edit which results in the DataCombo box containing the last edit and the text box with the most recent edit...very strange! Thanks again for your help, any other suggestions would be great.
Tom
-
Jan 6th, 2000, 05:56 PM
#7
Thread Starter
New Member
Hello, me again, I have just found out that if I exit the form and go back in then the DataCombo box updates, however, if I use Unload Form and then Form.Show it does not, could it be something to do with the way I have opened the database, caching or something????
Thanks
Tom
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|