Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Search question

Posted on 2002-03-19
3
Medium Priority
?
148 Views
Last Modified: 2010-05-02
i have a form with 3 textboxes across called

"Product description", "UnitPrice" and "Discount"

i have coppied these down in a control array ie

txtProductDescription(1)
txtProductDescription(2)

etc for each of the 3, what i would like to know is whenever i type in a product in the product description textbox it searches the "Products" table in my Access database and updates the other fields across with the appropriate information. How could i do this? and make it work for each txtbox down?

i am using the standard data control

thanks for any help!

0
Comment
Question by:digitaldestruction66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:alaplume
ID: 6880741
The control array will share a change event and provide and index telling you what control has focus.
0
 
LVL 39

Accepted Solution

by:
appari earned 600 total points
ID: 6881554
something like this in validate event

Private Sub txtProductDescription_Validate(Index As Integer, Cancel As Boolean)
If txtProductDescription(index)<> "" Then
   '**** Get Data from tables
  strSQL=" Select * from Table where roduct=" & txtProductDescription(index)
  'create recordset using ur connection
  if not recordset.eof then
      unitprice(index)=recordset("unitprice")
      discount(index)=recordset("discount")

  else
      msgbox "no data found for this product"
      cancel=true
  endif
End If
End Sub
0
 

Author Comment

by:digitaldestruction66
ID: 6883127
thanks appari, i modified it a bit but it doesn't seem to compile, can you help please? I have upped the points to 200. The code is below

Private Sub txtProductID_Validate(Index As Integer, Cancel As Boolean)
Dim RS As Recordset
Dim strSQL As String
    If txtProductID(Index) <> "" Then
  '**** Get Data from tables
  datProducts.RecordSource = strSQL
 strSQL = " Select * from Products where ProductName=" & txtProductID(Index)
 'create recordset using ur connection
 If Not RS.EOF Then
     txtUnitPrice(Index) = RS("UnitPrice")
     'txtDiscount(Index) = RS("discount")

 Else
     MsgBox "no data found for this product"
     Cancel = True
 End If
End If
End Sub

i am a beginner at this so an explanation would be excellent, the more help i get the more points you get!

cheers

DD66
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question