Connecting Tech Pros Worldwide Forums | Help | Site Map

Tough Question about subtable/subform

Member
 
Join Date: Mar 2008
Posts: 114
#1: Jul 1 '08
I have a table (tblOne) it has 2 columns and about 25 rows under column1. Basically I have Cars as the Column header and 25 different types of cars for rows, and Qty for the column header2.

Cars///Qty
1/////////15
2/////////16
3/////////17
4/////////100

I need the users to enter the qty into this subtable/subform and then i need to validate what they put in. For instance if they put in 100 i want to ask them did they mean to put in 100 Volvo's. Also i'll need to perform some other basic functions such as adding up the qty etc, but once i get rolling i think i can figure the rest out.

First, Is there a way to do this and how?
Secondly, Is there a way without using .ado or .dao?
Thirdly, If i have to use .ado/.dao what is the code for it. I have no clue how to use these functions.

Thanks much!

missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,000
#2: Jul 2 '08

re: Tough Question about subtable/subform


This will do what you want:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CarQuantity_BeforeUpdate(Cancel As Integer)
  2.  Resp = MsgBox("Did you mean to enter " & Me.CarQuantity & " " & Me.CarMake & "'s ?", vbYesNo)
  3.  If Resp = vbNo Then
  4.    Cancel = True
  5.    Me.CarQuantity.SelStart = 0
  6.    Me.CarQuantity.SelLength = Len(Me.CarQuantity)
  7.  End If
  8. End Sub
  9.  
but I have to tell you, asking the users if they're sure they want to enter what they just entered, each time, will mot endear you to them, especially if they're entering a large number of these at a time. This kind of thing is usually only done if the data entered falls outside of a predetermined value, such as over 100 or less than 10.

Linq ;0)>
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#3: Jul 2 '08

re: Tough Question about subtable/subform


Neither DAO nor ADO should be required in your solution :)

Check out Linq's code (and his advice). Both are worth reading.
Member
 
Join Date: Mar 2008
Posts: 114
#4: Jul 2 '08

re: Tough Question about subtable/subform


Ok thanks for your replies! I'll give it a try and hopefully all will be well.
Reply