Buenas noches, estoy intentando elaborar me una base de datos para la cocina manejando recetas, escandallos de platos, etc. y para ello necesito poner fotos de cada receta. Según he leído ha esto se le denomina vincular fotos al formulario. Tengo el código creado en vba pero cuando ejecuto sale un mensaje que pone "error 7 en tiempo de ejecución: memoria insuficiente". Os pego el código conforme lo tengo hasta hora:
Option Compare Database
Option Explicit
Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Const OFN_READONLY = &H1
Public Const OFN_OVERWRITEPROMPT = &H2
Public Const OFN_HIDEREADONLY = &H4
Public Const OFN_NOCHANGEDIR = &H8
Public Const OFN_SHOWHELP = &H10
Public Const OFN_ENABLEHOOK = &H20
Public Const OFN_ENABLETEMPLATE = &H40
Public Const OFN_ENABLETEMPLATEHANDLE = &H80
Public Const OFN_NOVALIDATE = &H100
Public Const OFN_ALLOWMULTISELECT = &H200
Public Const OFN_EXTENSIONDIFFERENT = &H400
Public Const OFN_PATHMUSTEXIST = &H800
Public Const OFN_FILEMUSTEXIST = &H1000
Public Const OFN_CREATEPROMPT = &H2000
Public Const OFN_SHAREAWARE = &H4000
Public Const OFN_NOREADONLYRETURN = &H8000
Public Const OFN_NOTESTFILECREATE = &H10000
Public Const OFN_NONETWORKBUTTON = &H20000
Public Const OFN_NOLONGNAMES = &H40000
Public Const OFN_EXPLORER = &H80000
Public Const OFN_NODEREFERENCELINKS = &H100000
Public Const OFN_LONGNAMES = &H200000
Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOPENFILENAME As OPENFILENAME) As Long
Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOPENFILENAME As OPENFILENAME) As Long
Declare Function GetFileTitle Lib "comdlg32.dll" Alias "GetFileTitleA" (ByVal lpszFile As String, ByVal lpszTitle As String, ByVal cbBuf As Integer) As Integer
Public Const OFN_SHAREFALLTHROUGH = 2
Public Const OFN_SHARENOWARN = 1
Public Const OFN_SHAREWARN = 0
Function DialogoComun(ObjForm As Form, FiltroArch As String, TipoArch As String, DirectIni As String) As String
Dim file As OPENFILENAME, sFile As String, sFileTitle As String, lResult As Long, iDelim As Integer
file.lStructSize = Len(file)
file.hwndOwner = ObjForm.Hwnd
file.flags = OFN_HIDEREADONLY + OFN_PATHMUSTEXIST + OFN_FILEMUSTEXIST
file.lpstrFile = FiltroArch & String$(250, 0)
file.nMaxFile = 255
file.lpstrFileTitle = String$(255, 0)
file.nMaxFileTitle = 255
'Path Inicial
file.lpstrInitialDir = ObjForm.RutaInicial 'Environ$(DirectIni)
'Filtro
file.lpstrFilter = TipoArch & Chr$(0) & FiltroArch & Chr$(0)
file.nFilterIndex = 1
'Título del diálogo
file.lpstrTitle = "Open"
lResult = GetOpenFileName(file)
If lResult <> 0 Then
iDelim = InStr(file.lpstrFile, Chr$(0)) esta linea aparece en color amarillo
If iDelim > 0 Then
sFile = Left$(file.lpstrFile, iDelim - 1)
End If
DialogoComun = sFile
End If
End Function
si alguien me pudiera ayudar se lo agradeceré ya que estoy un poco atascado en este proceso