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

AfterUpdate() sub to delete date from table

Status
Not open for further replies.

siktir23

Technical User
Mar 7, 2008
9
US
I'd like to think that I'm decent at coding stuff sometimes but I'm having a VERY bad day today. Not enough sleep or something. I'm trying to do something so simple, yet I can't get it.

I have a table called "drinfo". In that table, I have a field called "DateResponseRecvd". I've added a checkbox called "MoreInfoNeeded" to a form that, when checked, needs to clear the date in "DateResponseRecvd".

I'm trying to use the AfterUpdate() sub:

Private Sub MoreInfoNeeded_AfterUpdate()
DateResponseRecvd.Value = Null
Me.Requery
End Sub

...but it isn't working because the DateResponseRecvd field isn't a field on the form.

Can anyone point me in the right direction?

Thanks
 

How about something like...
Code:
Private Sub MoreInfoNeeded_AfterUpdate()
    Dim strSQL as String
    strSQL = "UPDATE MyTable SET DateResponseRecvd = '' "
    strSQL = strSQL & "WHERE IDField = " & Me.TextBoxName
    DoCmd.RunSQL strSQL
End Sub


Randy
 
Thanks for the post randy700. Not sure I understand the...

Code:
"WHERE IDField = " & Me.TextBoxName

...part though. Am I supposed to change TextBoxName to the name of my checkbox (MoreInfoNeeded)?

 

Change TextBoxName to the name of a textbox on your form that identifies the record (primary key).

Randy
 
Thanks for trying to help me randy.

Now I keep getting a pop up box asking for the IDField number?? I'm soooooooo frustrated!

I just feel like we're making this waaaaaaaaaaaaay too hard. Certainly, something as simple as deleting a date in a field by placing a check in a checkbox is more of a standard procedure?

Check... clear date... done. Simple, easy...

Arrrrggg!

 

What is the record source for your form?
What fields are in the table/query?
What fields are displayed on the form?


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top