Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Referring to Form Text Box from Module

Status
Not open for further replies.
Feb 8, 2002
43
US
With rs

I am trying to compare a field in a recordset with info in a textbox from a form based on the same table.


I.e. Both the recordset and the form are based on a table called remittance. The error I recieve is "Object variable or with block variable not set". Note: Dumb- is a variable of type Form_Remittance. rs - is the recordset based off of Remittance

Here is the code snippet where I am recieving the problem:

Do While Not .EOF
''''''''''''Get error on line below on both Dumb.---.--- statements'''''''''''''''''''''''''''''''''''''''''''''''

If rs!Remitter = Dumb.Remitter.Text Then
If rs!checknum = Dumb.Che.Text Then
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Answer = MsgBox("You may have entered a duplicate check. Do you want to ensure that no duplicate checks are entered into the database?", vbYesNo, "Possible Duplicate Check")
Else
rs.MoveNext
End If
Else
rs.MoveNext
End If
Loop

What is my problem and how do I refer to a a specific Form's textbox in a code module?

Thanks in Advance.

Jason
 
Jason,

You might try rst![Remitter] = Dumb.Remitter.text then
if rs![Checknum] = Dumb.Che.text then

I think this will help!

Dugger
 
Thanks, but I still get the same error. The error is being caused by this

Dumb.Remitter.Text

and Dumb.che.text

These two are not set right, the first part rs!remitter is being read right by access.

Any more help would be greatly appreciated.

Jason
 
I thought I should mention this also! Forms!YOURFORMNAME.Dumb.Remitter.Text or you might try Forms!YOURFORMNAME.Dumb.Remitter.Value

I have had these same types of problems many times and for me it is a matter of trial and error.

Let me know if this works.
Dugger
 
What is Dumb? Is it a form? If it is the form name then it would be Forms!Dumb.Remitter.Text

 
Dumb is a variable that holds the form.

declared like this

Dim Dumb as Form_Remittance
 
In that case use this:

Forms(Dumb).Remitter.Text

Dugger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top