checkboxes not updating and how do I move to next record?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where I compare two records from two different tables.
If the records match, I need the onEPLSDb checkbox checked off and the
RecordScrubbed checkbox checked off.

If they don't match, I only need the RecordScrubbed checkbox checked off.

My problem is that the check boxes are not getting checked off in either
situation.
Also. I'd like to move to the next record so I can repeat the if statement
through the databse.

My code is below. Any help would be appreciated.

Thanks,
Tina






Private Sub Command70_Click()

Dim RecordScrubbed As Boolean
Dim OnEPLSDb As Boolean
Dim EPLSName As String
Dim ScrubbedSupplierName1 As String

On Error Resume Next

If tblsuppliername.ScrubbedSupplierName1 Like tbleeplsdb.EPLSName Then

RecordScrubbed = 1
OnEPLSDb = 1

Else
RecordScrubbed = 1
OnEPLSDb = 0

End If

End Sub
 
Tina said:
I have a form where I compare two records from two different tables.
If the records match, I need the onEPLSDb checkbox checked off and the
RecordScrubbed checkbox checked off.

If they don't match, I only need the RecordScrubbed checkbox checked off.

My problem is that the check boxes are not getting checked off in either
situation.
Also. I'd like to move to the next record so I can repeat the if statement
through the databse.

Private Sub Command70_Click()

Dim RecordScrubbed As Boolean
Dim OnEPLSDb As Boolean
Dim EPLSName As String
Dim ScrubbedSupplierName1 As String

On Error Resume Next

If tblsuppliername.ScrubbedSupplierName1 Like tbleeplsdb.EPLSName Then

RecordScrubbed = 1
OnEPLSDb = 1

Else
RecordScrubbed = 1
OnEPLSDb = 0

End If
End Sub


The first thing that jumps out at me is that you have
declared local variables and then set them instead of
setting the check boxes. The values in the variables are
then discarded when the procedure exits.

If the name of the check boxes are as you described, then
get rid of the Dim Statements so your code can refer to the
check boxes.

Your If statement also looks suspicious. It appears that
you are trying to refer to fields in a table when you should
be referring to controls on the form. You haven't explained
enough for me to figure out what you really need, but maybe
it should be:

If Me.ScrubbedSupplierName1 = Me.EPLSName Then
 
Marshall,

Thanks for the reply. I don't know VBA as well as I would like to.

What I'm trying to do is compare the name fields of two tables. The name
fields don't match exactly and that's why I was trying to use the "like"
operator. I got the database to work using a parameter query with the like
operator. But this only works if I enter one name at a time. This isn't
very time efficient since I need to compare my 800+ names to a database of
50K names that I download on a monthly basis. I thought it might be more
efficient to use a form and have the verification process done through a
command button.

I need to automate this process by doing two things:
1) compare the name field in one table to the name field in the other table.
If a match is found, check off both boxes. If a match is not found, only
check off the record scrubbed box.
2) cycle through each name record in the supplier name table so I can
automate the verification process.

Both tables are independant of each other so there's no way for me to link
them. Not sure if that's my problem also.

Hope that clarifies things.

Thanks for your help.
 
Tina said:
Marshall,

Thanks for the reply. I don't know VBA as well as I would like to.

What I'm trying to do is compare the name fields of two tables. The name
fields don't match exactly and that's why I was trying to use the "like"
operator. I got the database to work using a parameter query with the like
operator. But this only works if I enter one name at a time. This isn't
very time efficient since I need to compare my 800+ names to a database of
50K names that I download on a monthly basis. I thought it might be more
efficient to use a form and have the verification process done through a
command button.

I need to automate this process by doing two things:
1) compare the name field in one table to the name field in the other table.
If a match is found, check off both boxes. If a match is not found, only
check off the record scrubbed box.
2) cycle through each name record in the supplier name table so I can
automate the verification process.

Both tables are independant of each other so there's no way for me to link
them. Not sure if that's my problem also.

Hope that clarifies things.


That question sounds like it goes way beyond the scope of a
newsgroup thread. I suggest that you think about coming up
with a clear statement of how to match records in the two
tables. Remember that Like is only useful with a wildcard
pattern. without wildcards, it does the same operation as
equals.

If the Scrubbed and "other" check box fields are in one
table, then maybe you can do all this in one shot using an
update query. OTOH, if you need to visually verify which
name goes with which, maybe you need to use a subform to
list the candidate matches so the users can determine
if/which record matches the name on the main form and set
the check boxes manually, because only a human can decide
what is a match and what is a comuputer's bad guess.
 
Back
Top