By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,838 Members | 1,675 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,838 IT Pros & Developers. It's quick & easy.

How can I reflect changes to table

P: 9
I have an unbound form, whose combobox and textboxes are also unbound.

The form's record source is a query (getdata) .
It has combo box whose rowsource is the same query. The afterupdate event for the combobox assigns a column from the query, (Document_Control_Number), + 1, to a textbox in the form.

When the form is submitted, the values are added into the table, but when I make a selection in the combobox, it does not use the updated Document_Control_Number to assign a value to the textbox

I want the form to reflect the changes in the table.

I tried Form.requery, but this didn't seem to work.
Does anybody have a suggestion?
Oct 16 '08 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
I have an unbound form, whose combobox and textboxes are also unbound...

The form's record source is a query (getdata) .
I think we'd all be interested to know how you did this! If the form has a record source, by definition, the form is bound, not unbound! Which begs the question of why have a bound form with unbound textboxes?

We need to know whether your form is bound or not and whether your textboxes are bound or not. Also how are you "submitting the form?"


Linq ;0)>
Oct 16 '08 #2

P: 9
I think we'd all be interested to know how you did this! If the form has a record source, by definition, the form is bound, not unbound! Which begs the question of why have a bound form with unbound textboxes?

We need to know whether your form is bound or not and whether your textboxes are bound or not. Also how are you "submitting the form?"


Linq ;0)>
Thank you for the reply Linq. I used a solution that is working: Upon submitting the form, I run a macro to close and open the form, and the updated value in the table is reflected. I dont know if this is the best solution.

I actually was using a record source for the form but it turned out the form works the same without that record source. The form is unbound, and the textboxes and comboboxes are all unbound.

To submit the form, it connected to the database and opens the table, then adds each of the object values to the table fields. Here is some code:

Set cnn1 = New ADODB.Connection
mydb = "H:\DataManagement.mdb"
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mydb
cnn1.Open strCnn

' Open Document Control Table table.
Set rstdatamanagement = New ADODB.Recordset
rstdatamanagement.CursorType = adOpenKeyset
rstdatamanagement.LockType = adLockOptimistic
rstdatamanagement.Open "tblDocumentControl", cnn1, , , adCmdTable


'get the new record data
rstdatamanagement.AddNew
rstdatamanagement!Document_Control_Number = Document_Control_Number
rstdatamanagement!Doc_Type_Num = Doc_Type_Num.Column(0)
rstdatamanagement!Document_Name = Document_Name
.
.
rstdatamanagement.Update
Oct 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.