Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 03-12-2013, 05:15 AM   #1
magster06
Newly Registered User
 
Join Date: Sep 2012
Location: Ohio
Posts: 235
Thanks: 62
Thanked 5 Times in 5 Posts
magster06 is on a distinguished road
cbo from main form to reference control on subform

Hi guys,

Ok, this is what I have:

I have setup my main form with 2 subforms to mimic a split form; this works fine.

To search for a record, I am using a cbo on the main form which I would like the user to select from. Once selected, then this will populate the first subform.

This is the code I have for the cbo:

Code:
Dim intAnswer As Integer
 
     If IsNull(Me!cboCaseNoCFDWit) Then Exit Sub
    With Me!sfFocus.Form.RecordsetClone
      .FindFirst "Me!sfFocus.Form!CaseNumber = """ & Me!cboCaseNoCFDWit & """"
      If Not .NoMatch Then
         If Me.Dirty Then Me.Dirty = False
         Me!sfFocus.Form.Bookmark = .Bookmark
      Else
         intAnswer = MsgBox("The Case Number was not found! Do you wish to add a Focus to PSU Case Number """ & Me!cboCaseNoCFDWit & """ ", vbYesNo + vbInformation, "Case Number Not Found")
            If intAnswer = vbYes Then
                DoCmd.GoToRecord , , acNewRec
                txtCaseNumber = "" & Me!cboCaseNoCFDWit & ""
            Else
                Exit Sub
            End If
 
      End If
    End With
I get an error at the .findfirst; states that the Microsoft Engine does not recogize Me!sfFocus.Form!CaseNumber

And the reason I am not using a regular split form is because I cannot, for the life of me, get the form to the size that I want. The splitform works great with the code above (a few changes to it of course), but the bottom of the splitform (datasheet) is too long and I cannot shorten it.

magster06 is offline   Reply With Quote
Old 03-12-2013, 05:23 AM   #2
magster06
Newly Registered User
 
Join Date: Sep 2012
Location: Ohio
Posts: 235
Thanks: 62
Thanked 5 Times in 5 Posts
magster06 is on a distinguished road
Re: cbo from main form to reference control on subform

Man, I must not have had enough coffee, lol.

I just realized that I was trying to reference a control and I really needed to reference the table, arrrgh!

Sorry to waste a thread guys!
magster06 is offline   Reply With Quote
Old 03-12-2013, 05:34 AM   #3
magster06
Newly Registered User
 
Join Date: Sep 2012
Location: Ohio
Posts: 235
Thanks: 62
Thanked 5 Times in 5 Posts
magster06 is on a distinguished road
Re: cbo from main form to reference control on subform

Ok, I guess I dont have it work correctly, darn.

I did get the error to stop, but now whatever record I click on in the cbo I get the message box telling me that the record is not there, which it is.

Would it have to do with the cbo reference?

Code:
.FindFirst "CaseNumber = """ & Me!cboCaseNoCFDWit & """"
OR is there a way to accomplish the same thing (mimic split form) with just one subform and the main form?

Also, I just found that if I changed the splitform property "auto resize" to "no", then I can get it to the size I want.

I still would like to know what I am doing wrong in the above code though.


Last edited by magster06; 03-12-2013 at 05:50 AM.
magster06 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open form having reference control in subform mubi_masti Forms 4 05-22-2012 09:47 PM
Reference a SubForm Control on a Second From the First Form Steve R. Code Repository 0 10-27-2011 06:06 AM
Control for a subform on the main form fenhow Forms 5 08-01-2007 01:19 PM
Get subform's control in the main form. dudezzz Forms 1 02-21-2005 01:05 PM
pop control in subform from main form TLJ Forms 5 08-25-2003 06:48 AM




All times are GMT -8. The time now is 04:14 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World