Subform

L

learning_codes

Hi,

I'm having a trouble trying to check the field from the subform on the main form. I'm not sure if I did the right path "IsNull([Forms].[Subform].[Completion Date]) "

Here is the sample:

If IsNull([Forms].[Subform].[Completion Date]) Then
If vMissing <> 0 Then strMess = strMess & "" Else vgoto = 1
strMess = strMess & "Missing Date" & vbCrLf
vMissing = vMissing + 1
End If

I would be happy to hear from your feedback.
Thanks
 
J

John W. Vinson

Hi,

I'm having a trouble trying to check the field from the subform on the main form. I'm not sure if I did the right path "IsNull([Forms].[Subform].[Completion Date]) "

Here is the sample:

If IsNull([Forms].[Subform].[Completion Date]) Then
If vMissing <> 0 Then strMess = strMess & "" Else vgoto = 1
strMess = strMess & "Missing Date" & vbCrLf
vMissing = vMissing + 1
End If

I would be happy to hear from your feedback.
Thanks

The proper syntax is

[Forms]![yourmainformname]![subformcontrol].Form![controlname]

or you can use the Me! shortcut to refer to the name of the main form:

Me![subformcontrol].Form![controlname]

If (and I very much doubt this is the case!) you used "Subform" as the Name
property of the subform control (the box on the mainform, not the form object
within that box, though they might both have the same name), you should be
able to use

If IsNull(Me![Subform].Form![CompletionDate]) Then

--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
L

learning_codes

Thank you so much John.

It works but I'm having a trouble with continuious form and keep showing Missing while I have the data.

Your help much appreciated.

Thanks
 
J

John W. Vinson

L

learning_codes

Hi,

Subform has continuous Form. When I enter the date and return to main menuand keep telling me "Missing: Completion Date" but I already enter a date.I notice that the subform has not saved after enter the completion date. Am I do wrong ?

***************************
If IsNull(Me.[Form]![Subform]![COMPLETION_DATE]) Then
If vMissing <> 0 Then strMess = strMess & "" Else vgoto = 8
strMess = strMess & "Missing: Completion Date" & vbCrLf
vMissing = vMissing + 1
End If
***************************

It works nicely but it keep showing "Missing: Completion Date". Is there a way for me to enter a date and save automaticly then return to Main Menu.

Thanks again.
 
J

John W. Vinson

Hi,

Subform has continuous Form. When I enter the date and return to main menu and keep telling me "Missing: Completion Date" but I already enter a date. I notice that the subform has not saved after enter the completion date. Am I do wrong ?

***************************
If IsNull(Me.[Form]![Subform]![COMPLETION_DATE]) Then
If vMissing <> 0 Then strMess = strMess & "" Else vgoto = 8
strMess = strMess & "Missing: Completion Date" & vbCrLf
vMissing = vMissing + 1
End If
***************************

It works nicely but it keep showing "Missing: Completion Date". Is there a way for me to enter a date and save automaticly then return to Main Menu.

Thanks again.

Is the NAME property of the subform control - on the main form, the box
containing the continuous subform - in fact "Subform"? I bet it isn't; you
need to replace

Me.[Form]![Subform]

with

Me![nameofthesubformcontrol]

Also, a reference to a control on a continuous subform will refer to the
currently active, selected record on the subform.

You might want to put some code in the AfterUpdate event of the form you're
using in the subform, if only

Private Sub Form_AfterUpdate()
Debug.Print Me.[COMPLETION_DATE]
End Sub

to verify that the subform is in fact updating. Also note that the names

[COMPLETION DATE]

and

[COMPLETION_DATE]

are - as far as Access is concerned - completely different and unrelated; a
blank is one character, an underscore is a different character.

I have no trace of a clue what the

vgoto = 8

is intended to do...

--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
L

learning_codes

Hi John,

I tried and it still does not work.

vgoto = 8... here is there to:

MsgBox "Missing Info: " & Chr(10) & Chr(10) & Chr(13) & strMess & vbCrLf, vbOKOnly, "Save Not Completed"

Cancel = True
Select Case vgoto
Case 8
Me.[Completion_Date].SetFocus

I use "Completion_Date" not "Completion Date".

When I enter the date in the subform and it does not save till I go to the main screen and click one of the box and the subform automaticly become save but continue to add record that is a blank. I already have a date in thesubform and it does not want me to go back to Main Menu. I select the design mode, and return to Form View, it works. I don't know what happened but I hope you know what went wrong.

Thanks again.
 
J

John W. Vinson

When I enter the date in the subform and it does not save till I go to the main screen
and click one of the box and the subform automaticly become save but continue to add
record that is a blank. I already have a date in the subform and it does not want me
to go back to Main Menu. I select the design mode, and return to Form View, it works.
I don't know what happened but I hope you know what went wrong.

Are you typing anything into any field? If the Date textbox has a Default
Value you will see that value on the screen, but nothing will be saved to disk
until you "dirty" the record by either manually typing into a control, or
using code to fill in some other value.

I don't understand what you mean by "does not want me to go back to Main
Menu". You have not said anything about that nor posted any error message
(though your newsreader strings out every paragraph into one long line...
yuck...)
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top