0

I have a form with a combo box for a user to select from a range of dates. The form is based of a table where each date is a record. Each date has up to 6 attachments, each in a separate field. How can I check if an attachment field is empty when a user selects a date? I am trying to code an "On Click" event.

I also want to make it so that if a certain field lacks an attachment, then the checkbox that would normally allow a user to select that attachment will be greyed-out and say something like "No data exists for this date"

I tried doing a simple if statement

'Go through the recordset, testing each record to see if the date matches the selected one
'If it doesn't match, go to the next one
While Not fldDate = dteDate
    rst.MoveNext
    Wend
MsgBox fldDate

If rstPIANO.Fields("FileName") = Null Then MsgBox "No PIANO Data exists for this date"
If rstMassBalance.Value = Null Then MsgBox "No Mass Balance Data exists for this date"
If rstIR.Value = Null Then MsgBox "No IR Data exists for this date"
If rstD86.Value = Null Then MsgBox "No D86 Data exists for this date"
If rstGC.Value = Null Then MsgBox "No GC Data exists for this date"
If rstMiniGasGraphs.Value = Null Then MsgBox "No Mini Gas Graph Data exists for this date"

This gives me an error that says "Object invalid or no longer set"

Erik A
  • 31,639
  • 12
  • 42
  • 67
user2521720
  • 59
  • 1
  • 3
  • 7
  • What do you mean by "attachement" are they files on the filesystem ? rows in some table of you DB ? Your 2nd sentence ends prematurely after "separate" ... separate what ? – d-stroyer Jul 09 '13 at 06:56
  • Please describe what you have tried so far and why it did not work. – d-stroyer Jul 09 '13 at 06:56

1 Answers1

0

Your recordset is called rst you are calling it something different in each IF statement rstPiano does not exist use If rst.fields("Piano") = null

basdwarf
  • 422
  • 1
  • 3
  • 8