how to reference a text box in a separate form?

msgbox DLookup("[Movie Covers]" , "options_menu_folders_directories")

didn't work at first but then I noticed that it's name is options_menu_folder_directories. pop up window worked showing the path in that is in the table/in the text box of the options menu form.

just to test it further I went into the options menu and changed the file path as a user would, and close the form. I then clicked the newly created button and the message box displayed the new path. so all is good there. So I guess the next step would be to add it to my movie covers VBA code?

'Movie Covers

box.Picture = "J:\Media\Database\Movie Database\Movie Covers\default.jpg" 'default value

If Me.Use_Alt_Name = True Then
box.Picture = "J:\Media\Database\Movie Database\Movie Covers\" & (Me.Alt_Name) & ".jpg"
End If

If Me.Use_Alt_Name = False Then
box.Picture = "J:\Media\Database\Movie Database\Movie Covers\" & (Me.film_name_box) & ".jpg"
End If


replace the red with the dlookup somehow?
 
Got it working, new code is;

'Movie Covers

box.Picture = DLookup("[Movie Covers]", "options_menu_folder_directories") & "\" & "default.jpg" 'default value

If Me.Use_Alt_Name = True Then
box.Picture = DLookup("[Movie Covers]", "options_menu_folder_directories") & "\" & (Me.Alt_Name) & ".jpg"
End If

If Me.Use_Alt_Name = False Then
box.Picture = DLookup("[Movie Covers]", "options_menu_folder_directories") & "\" & (Me.film_name_box) & ".jpg"
End If


I really appreciate all your help Ken!

One last question (NooB question) Instead of re-typing the Dlookup line over and over, how is it that I define that line and just use that definition....for example

set
DLookup("[Movie Covers]", "options_menu_folder_directories"))= varA

box.Picture = (VarA) & "\" & (Me.film_name_box) & ".jpg"


Is that when you use Dim? Or is that a string?


 
The dlookup returns what it finds so you can just dim a string var and assign the result of the dlookup to it:

dim strMyPath1 as string
strMyPath1 = DLookup("[Movie Covers]", "options_menu_folder_directories")
box.Picture = strMyPath & "\" & "default.jpg"
etc...
 

Users who are viewing this thread

Back
Top Bottom