Set Temp Var - VBA code

tihmir

Registered User.
Local time
Yesterday, 22:39
Joined
May 1, 2018
Messages
257
Hi all.
I have a Macro Bilder on the command button "X". The Macro is:

SetTempVar
Name temVarCityID
Expressen = [ cboCity]
OpenForm
Form name fmControl
View Form
Where Condition = [ CityID]=[TempVars]![temVarCityID]


I need to add and "If cboCity is Null then message "Plesase, choose City"


So, I want to this in VBA code. Please, how to do it?
 
Code:
If Len(Me.cboCity & vbNullString) = 0 Then
  MsgBox "Please..."
Else
  DoCmd.OpenForm...
End If
http://www.baldyweb.com/wherecondition.htm


Thanks you, but I want to write in vba all this:


SetTempVar
Name temVarCityID
Expressen = [ cboCity]
OpenForm
Form name fmControl
View Form
Where Condition = [ CityID]=[TempVars]![temVarCityID]
 
I wouldn't bother with the TempVar, unless it's needed elsewhere. I gave you a link with the code to open the form with a filter applied.
 
I wouldn't bother with the TempVar, unless it's needed elsewhere. I gave you a link with the code to open the form with a filter applied.
Oh, sorry. I will try the code now! :)
 
Post back if you get stuck. Using the TempVar there was just adding unnecessary code to the process. You can refer directly to the combo, as shown in the link.
 
Happy to help!
 

Users who are viewing this thread

Back
Top Bottom