Hello all!
I hope you can help me with this one. I am a SQL DBA so Access is familiar but still sometimes like a different language to me!![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
Here is the scenario:
I have one form = FormPCM
3 combo boxes = Platform
Stage
Component
I have one text box = Cost
Query = PCMQuery
I want the user to select what they want from each of the combo boxes and according to their selections autoupdate the text box with the associated cost from the Query it is all based on.
This is what I have so far:
Private Sub Cost_GotFocus()
Dim xCost as Currency
xCost = DLookup("[PCMCost]", "PCMQuery", PCMQuery.[PCMPlatformID] = Forms!FormPCM![Platform]& [PCMStageID] = Forms!FormPCM![Stage] & [PCMComponentID] = Forms!FormPCM![Component])
ME.Cost.Requery
End Sub
This works when I recreate it in a regular query with paramters however when I run it in the form I get the
Runtime 424
Object required
I can scroll over the form values in the Sub above and see they are populated properly but the xCost is still zero when this error occurs.
Once I get the appropriate cost I would like to have a command button that will populate the choices on a datsheet viewable on the form, this way the user can add several line items.
Any thoughts or ideas or an easier way to do this would be greatly appreciated!
Thanks in advance!![[afro2] [afro2] [afro2]](/data/assets/smilies/afro2.gif)
I hope you can help me with this one. I am a SQL DBA so Access is familiar but still sometimes like a different language to me!
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
Here is the scenario:
I have one form = FormPCM
3 combo boxes = Platform
Stage
Component
I have one text box = Cost
Query = PCMQuery
I want the user to select what they want from each of the combo boxes and according to their selections autoupdate the text box with the associated cost from the Query it is all based on.
This is what I have so far:
Private Sub Cost_GotFocus()
Dim xCost as Currency
xCost = DLookup("[PCMCost]", "PCMQuery", PCMQuery.[PCMPlatformID] = Forms!FormPCM![Platform]& [PCMStageID] = Forms!FormPCM![Stage] & [PCMComponentID] = Forms!FormPCM![Component])
ME.Cost.Requery
End Sub
This works when I recreate it in a regular query with paramters however when I run it in the form I get the
Runtime 424
Object required
I can scroll over the form values in the Sub above and see they are populated properly but the xCost is still zero when this error occurs.
Once I get the appropriate cost I would like to have a command button that will populate the choices on a datsheet viewable on the form, this way the user can add several line items.
Any thoughts or ideas or an easier way to do this would be greatly appreciated!
Thanks in advance!
![[afro2] [afro2] [afro2]](/data/assets/smilies/afro2.gif)