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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ON/Off column in table results not consistent 1

Status
Not open for further replies.

jpl458

Technical User
Sep 30, 2009
337
US
I have a table The contains an Yess/No column that is set false in the default value. This table gets it's entries from Program A with the following code:
DoCmd.SetWarnings False
SentSql = "INSERT INTO SentEmailTbl(Account_Number, Event, DateSent, Redempt_Value) " & _
"Values('" & GBL_Master_Id & "', '" & GBL_Event & "', # " & Now() & " #, " & coupValue & ")"
DoCmd.RunSQL SentSql
DoCmd.SetWarnings True

After inserting a record the check box is empty, and I assume is set to false.
In Program B I check to see if a coupon has been redeemed with the following code.

If RCMRs.Fields("Redempt_Flag") = True Then 'See if redeemed
DoCmd.OpenForm "frmApproval" ' If so fill out form
Dim DisDate As String
SentDate = CStr(EMailRs.Fields("DateSent"))
Dim inDate As Date
inDate = EMailRs.Fields(3)
Dim RedemDate As String
RedemDate = Format(inDate, "mm:dd:yyyy hh:mm:ss AMPM")
Forms!frmApproval.lblapproveBox.Caption = "Not Approved"
Forms!frmApproval.DenialReason.Value = "Previously Redeemed"
Forms!frmApproval.Detail.BackColor = vbRed

If the flag is False the code falls through to a routine that changes the flag from False to True. And when This runs and insert a record all is fine. But if I enter that same record again it falls through saying that this is a new record.

I have run a query against the table just to see what true and false meant and everything went well. So I must not be doing thins in the proper way.
I hope this is not too ambiguous. I could fix the problem by changing the Yes/no column to text, But I want to learn what's going on here.

Thanks in advance

jpl



 
I found the problem, I was using a piece of data from another (wrong) recordset.
Once I corrected that it worked as advertised.

Thanks

jpl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top