Object required?

M

maceslin

I am in frmSolLoc which is a subform on frmSolutions which is a
subform on frmBasic Data

I have used a Select Case statement to determine the RowSource for
cboSolLoc on frmSolLoc and am trying create a NotInList Event that
will open up the correct form to populate the correct table based on
what was selected.

Here is the code so far (liberally copied from other sources)
Private Sub cboSolLoc_NotInList (NewData as String, response as
Integer)

Dim Result
Dim Msg as string
Dim CR as string
Dim value as string
Dim table as string
Dim form as string

CR= Chr$(13)

If NewData="'" THen Exit Sub

Msg= "'"& NewData &"' in not in the list." &CR &CR
Msg =MSG & "Do you want to add it?"

if MsgBox(Msg, vbQuestion + vbYesNo)= vbYes Then
 
M

maceslin

I am in frmSolLoc which is a subform on frmSolutions which is a
subform on frmBasic Data

I have used a Select Case statement to determine the RowSource for
cboSolLoc on frmSolLoc and am trying create a NotInList Event that
will open up the correct form to populate the correct table based on
what was selected.

Here is the code so far (liberally copied from other sources)
Private Sub cboSolLoc_NotInList (NewData as String, response as
Integer)

Dim Result
Dim Msg as string
Dim CR as string
Dim value as string
Dim table as string
Dim form as string

CR= Chr$(13)

If NewData="'" THen Exit Sub

Msg= "'"& NewData &"' in not in the list." &CR &CR
Msg =MSG & "Do you want to add it?"

if MsgBox(Msg, vbQuestion + vbYesNo)= vbYes Then

' let me finsih since my machin hiccuped

IF frmBasicData!frmSolutions!cboDOTMLPF= "DOCTRINE" Then
value="DoctreinSolution"
table= "tblDoctrinesolLoc"
form= "frmDoctrineSolLoc

End IF
' 8 more of these IF Thens to add

DoCmd. OpenForm"form",,,acAdd,acDialog, NewData
Result=DLookup("Value","table", "[Value]='" &NewData &"'"

If IsNull(Result) Then
Response=acDataErrContinue
MsgBox "Plesae try again"
Else
Reposne= acDataErrAdded
End if
End Sub

2 questions
1. Does this approach make sense and is there any easier/better way?
2. The code block where I am assigning the variables I am getting an
object required error on IF frmBasicData!frmSolutions!cboDOTMLPF=
"DOCTRINE" Then and I can not figure out why

Thanks for looking
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top