473,388 Members | 1,207 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Combo box - New data

Hi,

I have been called the list of the Vendor Name in the combo box. This vendor name has been called from Vendor_Table.

Now, When I create New Vendor by using Double click event to open Vendor_Creation & created the New vendor name. But it is not coming to existing form's control where i hve been called by query as Rowsource.

But,once I close & re-open the existing form, it is coming.

Is there anyway to get new fresh data...?

Please suggest me.

Thanks in advance..

ngr.
Apr 14 '07 #1
6 3422
you may want to try this code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub SecondarySupplier_NotInList(NewData As String, Response As Integer)
  2. 'Suppress the default error message.
  3.  
  4.    Response = acDataErrContinue
  5.  
  6.     ' Prompt user to verify if they wish to add a new value.
  7.     If MsgBox("Supplier Name " & NewData & " is not in list. Add it?", vbYesNo) = vbYes Then
  8.  
  9.       ' Set Response argument to indicate that data is being added.
  10.       'Open a recordset of the Table.
  11.  
  12.       Dim db As Database
  13.       Dim rstSupplierName As Recordset
  14.       Dim sqltblSupplier As String
  15.  
  16.       Set db = CurrentDb()
  17.       sqltblSupplier = "Select * From tblSupplier"
  18.       Set rstSupplierName = db.OpenRecordset(sqltblSupplier, dbOpenDynaset)
  19.       'Add a new Name with the value that is stored in the variable NewData.
  20.       rstSupplierName.AddNew
  21.       rstSupplierName![SupplierName] = NewData
  22.       rstSupplierName.Update
  23.  
  24.       'Inform the combo box that the desired item has been added to the list.
  25.       Response = acDataErrAdded
  26.       rstSupplierName.Close 'Close the recordset
  27.    End If
  28.  
  29. End Sub
  30.  
Got the code somewhere from the net and used it...its doin fine
Good Luck!
Apr 16 '07 #2
Denburt
1,356 Expert 1GB
Now, When I create New Vendor by using Double click event to open Vendor_Creation & created the New vendor name. But it is not coming to existing form's control where i hve been called by query as Rowsource.

But,once I close & re-open the existing form, it is coming.
No need to open then reclose the main form it sounds like the form that you supply the new Vendor information needs to have an onClose event set to requery the main forms control.

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Close()
  2. 'Here I am calling the main forms subform and filling it with the info.
  3. With Forms!Distributions!DistributionsDet.Form
  4.         !PipeLineID.Undo
  5.         !PipeLineID.Requery
  6.         !PipeLineID = Me!PipeLineID
  7.         !ContractNo.SetFocus
  8.     End With
  9. End sub
Apr 18 '07 #3
Thanks a lot...

Its working fine..

Thnx..

ngr.
Apr 20 '07 #4
Denburt
1,356 Expert 1GB
Great so glad I could help.
Apr 20 '07 #5
Great so glad I could help.
==========
Fine. Actually, One new problem has arisen in that. When i open & CLOSE individually that form it shows the below error as i have given the close_event of the form.

Run-time error '2186'

This property isn't available in Design View

My code is...

With Form_Requisition_Creation.Form
Form_Requisition_Creation.Req_Account_id.Undo
Form_Requisition_Creation.Req_Account_id.Requery
Form_Requisition_Creation.Req_Account_id = Me.Account_Id
Form_Requisition_Creation.Req_Account_id.SetFocus
End With

Its given in Account_Creation close_event.

How could i avoid even when i open & close the form INDIVIDUALLY ?

Is there any other alternative?

Pls.suggest me.

Thnx..in advance.

ngr.
Apr 21 '07 #6
Denburt
1,356 Expert 1GB
I'm not sure I understand but I think you are trying to reference a form that is closed or in design view as the error states.
You can always check to see if the other form is loaded before you close the one generating the error...

==========
Fine. Actually, One new problem has arisen in that. When i open & CLOSE individually that form it shows the below error as i have given the close_event of the form.

Run-time error '2186'

This property isn't available in Design View

My code is...

With Form_Requisition_Creation.Form
Form_Requisition_Creation.Req_Account_id.Undo
Form_Requisition_Creation.Req_Account_id.Requery
Form_Requisition_Creation.Req_Account_id = Me.Account_Id
Form_Requisition_Creation.Req_Account_id.SetFocus
End With

Its given in Account_Creation close_event.

How could i avoid even when i open & close the form INDIVIDUALLY ?

Is there any other alternative?

Pls.suggest me.

Thnx..in advance.

ngr.
Apr 21 '07 #7

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

Similar topics

1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
1
by: Donna Sabol | last post by:
I have a form (frm_MAIN_RPT) that contains a combo box (Combo6) & subform (dbo_REQ_subform). The combo box is used to select the "cost center" data that will be displayed in the subform. From...
0
by: Andrew | last post by:
Hello, I am trying to create a chart whose underlying query is linked to 2 combo boxes on the same form. I want to pass the values from the combo boxes into the chart query to allow the chart...
6
by: Brian Henry | last post by:
Here's an example of the code.. I have two combo boxes on screen that when one's selection is change the other's items will be updated to reflect the change (based on a relation) Private...
2
by: kiranmn75 | last post by:
I want to dynamically populate a combo box through javascript. Data is coming from a array. Sometimes data list may contain items in excess of 2000. Explorer takes more than 5 seconds to...
3
by: rlm | last post by:
This small problem to solve involves a two table database (one parent and one child table), one winform and two combo boxes. Combo box A is populated in the Load event. Combo box A pulls data...
4
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. ...
2
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small...
0
by: Dawnyy | last post by:
I have a form which is bound to a dataset. I am filling the forms dataset on Form_Load event. On my form I have combo boxes which I am setting by running a stored procedure to return a datatable,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.