R
Rick S.
I am struggling with this. I have asked questions on other forums only to be
told I should do this or do that. But I am trying to learn how to do
something other than some ones typical use of something.
What I am doing is an excersize, alas, not for school.
One of my stumbling points are, helping members are proficiant with code, I
struggle to read some of it. I am quite proficiant in VBA for Excel, these
seem to be different animals allthough they both use VBA.
Using Textboxes (I know, I know, I should use cascading combo boxes).
I enter a value in textbox1, textbox2 should only have choices available per
the data from textbox1.
I think I should use DLookup but am struggling terribly to create correct
syntax. This code is in my BeforeUpdate event:
Private Sub sPartRev_BeforeUpdate(Cancel As Integer)
varX = DLookup("[tblParts]", "[txtPartNo]", "txtRev = '" & sPartRev & "'")
MsgBox varX
'Two lines above are new and do not work, below functions properly
If DCount("*", "tblPartRev", "txtRev = '" & Me.sPartRev.Text & "'") Then
bOk = True
SaveSetting AppName:="GeoMeasure", section:="CMM Data", _
Key:="sPartRev", setting:=sPartRev
Else
bOk = False
Cancel = False
MsgBox "The revision level doesn't match part numbers in this database.
Please re-enter the revision level."
End If
End Sub
I get:
Run-time error '3078':
The microsoft Jet database engine cannot find the input table or querry
'txtPartNo'. Make sure it exists and that its name is spelled correctly.
It exists and is spelled correctly.
tblParts is the table used for textbox1
tblPartRev contains data for txtRev (related to tblParts)
txtPartNo is the data from textbox1 (already looked up in tblParts)
sPartRev is the data entered in textbox2
Excluding the two errant lines, the code functions but I get all choices
from tblPartRev instead of choices related to the value from textbox1.
All help is appreocaited.
--
Regards
Rick
NT4.0
Office 2k
told I should do this or do that. But I am trying to learn how to do
something other than some ones typical use of something.
What I am doing is an excersize, alas, not for school.
One of my stumbling points are, helping members are proficiant with code, I
struggle to read some of it. I am quite proficiant in VBA for Excel, these
seem to be different animals allthough they both use VBA.
Using Textboxes (I know, I know, I should use cascading combo boxes).
I enter a value in textbox1, textbox2 should only have choices available per
the data from textbox1.
I think I should use DLookup but am struggling terribly to create correct
syntax. This code is in my BeforeUpdate event:
Private Sub sPartRev_BeforeUpdate(Cancel As Integer)
varX = DLookup("[tblParts]", "[txtPartNo]", "txtRev = '" & sPartRev & "'")
MsgBox varX
'Two lines above are new and do not work, below functions properly
If DCount("*", "tblPartRev", "txtRev = '" & Me.sPartRev.Text & "'") Then
bOk = True
SaveSetting AppName:="GeoMeasure", section:="CMM Data", _
Key:="sPartRev", setting:=sPartRev
Else
bOk = False
Cancel = False
MsgBox "The revision level doesn't match part numbers in this database.
Please re-enter the revision level."
End If
End Sub
I get:
Run-time error '3078':
The microsoft Jet database engine cannot find the input table or querry
'txtPartNo'. Make sure it exists and that its name is spelled correctly.
It exists and is spelled correctly.
tblParts is the table used for textbox1
tblPartRev contains data for txtRev (related to tblParts)
txtPartNo is the data from textbox1 (already looked up in tblParts)
sPartRev is the data entered in textbox2
Excluding the two errant lines, the code functions but I get all choices
from tblPartRev instead of choices related to the value from textbox1.
All help is appreocaited.
--
Regards
Rick
NT4.0
Office 2k