combo box not visable on form when loaded from specific location

T

Tim McD

I have a form that loads from different subforms. I use a combo box in one
case. However when I load the form from that combo box I what certain boxes
not to be visible on the loaded form. I'm using the afterupdate event to
load the form from the combo box. What code so I need to make these boxes
not visible after the form loads. I get an error as it loads that is cant
find the referred field in the expression.

rivate Sub cboSelectProject_AfterUpdate()
On Error GoTo Err_cboSelectProject_Click

Dim stDocName As String
stDocName = "frmProjectIndex"
stLinkCriteria = "[ProjectNumber]=" & "'" & Me![cboSelectProject] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Form![frmprojectindex]![cboVeiwAProject].Visible = False

Exit_cboSelectProject_Click:
Exit Sub

Err_cboSelectProject_Click:
MsgBox Err.Description
Resume Exit_cboSelectProject_Click

End Sub

I know this must be simple I'm just not seeing it.

Thanks for the help
Tim
 
B

boblarson

Could it possibly be that you have misspelled something?

Form![frmprojectindex]![cboVeiwAProject].Visible = False

if spelled correctly should be

Form![frmprojectindex]![cboViewAProject].Visible = False

VIEW is misspelled.
--
Bob Larson

Free Tutorials and Samples at http://www.btabdevelopment.com

__________________________________
 
T

Tim McD

I thought the same thing when I had the spelling correct in the code and then
noticed that it was misspelled on the form. I fixed the spelling in the code
and was going to back and correct the spelling if I got the code to work.
Although the spelling is wrong it matches the name of the combo box. Sorry
for the confusion. any other suggestions?

Tim

boblarson said:
Could it possibly be that you have misspelled something?

Form![frmprojectindex]![cboVeiwAProject].Visible = False

if spelled correctly should be

Form![frmprojectindex]![cboViewAProject].Visible = False

VIEW is misspelled.
--
Bob Larson

Free Tutorials and Samples at http://www.btabdevelopment.com

__________________________________


Tim McD said:
I have a form that loads from different subforms. I use a combo box in one
case. However when I load the form from that combo box I what certain boxes
not to be visible on the loaded form. I'm using the afterupdate event to
load the form from the combo box. What code so I need to make these boxes
not visible after the form loads. I get an error as it loads that is cant
find the referred field in the expression.

rivate Sub cboSelectProject_AfterUpdate()
On Error GoTo Err_cboSelectProject_Click

Dim stDocName As String
stDocName = "frmProjectIndex"
stLinkCriteria = "[ProjectNumber]=" & "'" & Me![cboSelectProject] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Form![frmprojectindex]![cboVeiwAProject].Visible = False

Exit_cboSelectProject_Click:
Exit Sub

Err_cboSelectProject_Click:
MsgBox Err.Description
Resume Exit_cboSelectProject_Click

End Sub

I know this must be simple I'm just not seeing it.

Thanks for the help
Tim
 
T

Tim McD

Thank you. You made me look hard at all my spellings I forgot the "s" in
forms!. I knew it was something dumb. Thats what I get for writing code on
Red Bull. This works:

Private Sub cboSelectProject_AfterUpdate()
On Error GoTo Err_cboSelectProject_Click

Dim stDocName As String
stDocName = "frmProjectIndex"
stLinkCriteria = "[ProjectNumber]=" & "'" & Me![cboSelectProject] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms![frmprojectindex]![cboVeiwAProject].Visible = False
Forms![frmprojectindex]![Combo73].Visible = False
Exit_cboSelectProject_Click:
Exit Sub

Err_cboSelectProject_Click:
MsgBox Err.Description
Resume Exit_cboSelectProject_Click

End Sub

both combo boxes are gone on the form load.

Thanks again
Tim



boblarson said:
Could it possibly be that you have misspelled something?

Form![frmprojectindex]![cboVeiwAProject].Visible = False

if spelled correctly should be

Form![frmprojectindex]![cboViewAProject].Visible = False

VIEW is misspelled.
--
Bob Larson

Free Tutorials and Samples at http://www.btabdevelopment.com

__________________________________


Tim McD said:
I have a form that loads from different subforms. I use a combo box in one
case. However when I load the form from that combo box I what certain boxes
not to be visible on the loaded form. I'm using the afterupdate event to
load the form from the combo box. What code so I need to make these boxes
not visible after the form loads. I get an error as it loads that is cant
find the referred field in the expression.

rivate Sub cboSelectProject_AfterUpdate()
On Error GoTo Err_cboSelectProject_Click

Dim stDocName As String
stDocName = "frmProjectIndex"
stLinkCriteria = "[ProjectNumber]=" & "'" & Me![cboSelectProject] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Form![frmprojectindex]![cboVeiwAProject].Visible = False

Exit_cboSelectProject_Click:
Exit Sub

Err_cboSelectProject_Click:
MsgBox Err.Description
Resume Exit_cboSelectProject_Click

End Sub

I know this must be simple I'm just not seeing it.

Thanks for the help
Tim
 

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