I'm writing a small app in Access using VB. I need to loop through all of the control names in the form and then delete the one in which the control name is "Title", and which is a label. 'Suppose all declarations are already made' For Each ctl In frm.Controls If ctl.ControlType = acLabel Then If ctl.name = "Title" Then ctl.?????? - removing/deleting step End If End If Next ctl
I don't know how to actually delete the controls. I can ADD controls and EDIT them OK, but deleting them is misleading me. Any ideas? Thanks.
reegan41
Posts
-
Removing Controls in Access forms using VB -
VB Shell Folder error handlerI have in my application a subroutine that opens a browse folder so that the user can browse to a specific directory, and load that into a text box. The code is like this: ...
Set shlShell = New shell32.Shell Set shlFolder = shlShell.BrowseForFolder(Me.hWnd, "Select a Folder", BIF_RETURNONLYFSDIR) textbox_txt.SetFocus textbox_txt.Text = shlFolder.Items.Item.Path 'places path into text box
Now, my problem is not when the user browses to a path and clicks OK, that returns the path of the directory fine. What the issue is, when the user clicks CANCEL, I get an error: runtime error '91' Object variable or With block not set. Any ideas on how I should handle this? Thanks. reegan41 -
using FileStreamsIs there a certain library I need to have referenced to my project in order to use I/O? Just wondering. Also, is there a way I can open a jpg with a FileStream object?
-
opening a JPG with VB through MSAccessHow do I use a PictureBox? Right now I have Dim picbox As PictureBox 'tried this and didn't work' picbox = LoadPicture("C:\file.jpg") 'tried this and got "type mismatch"' Set picbox = LoadPicture("C:\file.jpg")
-
opening a JPG with VB through MSAccessSorry, I wasn't clear enough...the picture is just saved on the local machine, not in my database...I just need to open it using the filepath as a parameter. I'm going to use a button and its Click() event to automatically browse to this path and open it.
-
opening a JPG with VB through MSAccessIs there code to open a jpg if I were using the vb editor in MS access? I need to click a button, then open the JPG. I have tried looking for controls but all are shareware which unfortunately is out of the question for my project. Does anyone know how to do this? I just need the picture to display (even if it is in the 'crappy' Windows Picture and Fax Viewer or whatever its called) Thanks a bunch.
-
opening a pdf with vb6Actually I didn't need anything 'third party' All you have to do is: Dim acroApp As New Acrobat.Acroapp acroApp.Show Dim acroDoc As New AcroAVDoc acroDoc.Open "C:\filename.pdf", "" thanks anyway though...finding freeware controls to open pdf sure was a pain, I'm glad "this" works!
-
opening a pdf with vb6Thanks Dave. Any recommendations? (ie, have you used one ever?)
-
opening a pdf with vb6I have a button, and once clicked, want it to open (and display) a pdf document. How do I go about this? Thanks.
-
Invoking a Button_Click() event from a seperate formThanks, I'll give it a shot
-
Invoking a Button_Click() event from a seperate formHi, I have two seperate forms. Lets just call them FormA and FormB. I have a function in FormA called Button_Click(). How would I (while in FormB) call this function? I have tried, while in the FormB code, using Form_FormA.Button_Click. But that doesn't seem to work. Can anyone help me with this?
-
getting a string full of apostrophesI'm making a log file and want to have a string of apostrophes to separate parts of the log file. Dim divider As String Dim t As TextStream 'other declarations are there like FileSystemObject but its irrelevant. The log works besides this string I desire' divider = "''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''" t.WriteLine(divider) Now I've tried using the escape character \', using hyphens (-) and asterisks(*). Any ideas?
-
using Word.Document's SaveAs Function (VB6)Hey, I'm trying to save a file with the SaveAs function under the Word.Document... However, if I have a file of the same name, it simply overwrites without giving me a prompt to do so.. Is there any way around this? I checked the list of parameters, and none of them give like, a boolean for 'SaveOverride' or whatever. Thanks. --- reegan41
-
Getting text from MS WordI'm doing it in VB6 through MS Access.
-
Getting text from MS WordIs it possible to get the text from a Word document (using the Word object library in VB6) and store that text into a string variable? If so, how do you do it?
-
Working with MS Word through VBA/MS AccessI have made a string variable and have populated it into a Word document (.doc). Now, is it possible to make changes to the text in the word document, then parse that information back into a string variable in the VBA code? (perferably replace the string I used to populate the Word document in the first place) Thanks for your help. --- reegan41
-
Undo not working after Worksheet_Change Sub Routine in ExcelIn excel, I have listboxes (validation) in column A, and columb B. The ones in A work. I wrote code to check to see when there's a change in any item in A, and if the user hit 'No' on the MsgBox, then the change would be 'Undone' (ie. managed to use Undo in VB code). My problem is, I'm using virtually the same code for column B. However, columb B's list items are a validated list depending on what was selected in A. Whenever a change is made in B, and the user hits no, Undo is NOT executed. Any ideas as to why this is happening? Here's a sample of the code that is working for A: (Note that the code I have for B is the exact same with different Range references) '''Code start'''' Public undoCheck As Boolean Private Sub Worksheet_Change(ByVal Target As Excel.Range) If undoCheck Then 'do nothing undoCheck = False Else Dim i As Integer Dim rowNum As Integer i = 10 While i < 85 If (Target.Address = "$A$" & i) And (Cells(i, 2).Value <> "" Or Cells(i, 3).Value <> "" Or Cells(i, 4).Value <> "" Or Cells(i, 5).Value <> "" Or Cells(i, 6).Value <> "" Or Cells(i, 7).Value <> "" Or Cells(i, 8).Value <> "") Then If MsgBox("You are changing Element Data. Related Element Data will be removed but calculation data will remain. Do you wish to continue?", vbYesNo) = VbMsgBoxResult.vbYes Then 'clear values Range("B" & i).Value = "" Range("C" & i).Value = "" Range("D" & i).Value = "" Range("E" & i).Value = "" Range("F" & i).Value = "" Range("G" & i).Value = "" Range("H" & i).Value = "" Range("I" & i).Value = "" 'highlight colours Range("C" & i).Interior.Color = vbYellow Range("D" & i).Interior.Color = vbYellow Range("E" & i).Interior.Color = vbYellow Range("F" & i).Interior.Color = vbYellow Range("G" & i).Interior.Color = vbYellow Range("H" & i).Interior.Color = vbYellow Range("I" & i).Interior.Color = vbYellow undoCheck = False Exit Sub Else undoCheck = True If Application.CommandBars.FindControl(ID:=128).Enabled = True Then Excel.Application.Undo
-
Selecting text from a Word documentthanks alot man Cheers, reegan41
-
Selecting text from a Word documentHey, I've created a word document and have added text to it. I now need to select this text and pass it to a string variable. Any ideas? Also, if this is possible, if some of the text was bolded...will those properties be passed through to the string variable? Just curious, thanks. --- reegan41
-
Using the LIKE keyword in a queryI actually figured it out...believe it or not, it was because I was using LIKE 'data%' instead of LIKE "data*" For some reason THAT worked instead...odd, but thanks for your help regardless