Re: Return To Open Spreadsheet After Pasting Into Word
I think it doesn't work because you open a new excel application.
Re: Return To Open Spreadsheet After Pasting Into Word
I think it doesn't work because you open a new excel application.
Re: Printing From A Command Button
Hi, I've tried your code and it works for me.
I've no idea why you get the error.
Re: Close Active Form Vb Query
You first have to define your public variabel, the best way is in a seperated module:
Private Sub Toggle563_Click()
select case intoption
case 1
unload frm...(your form name)
case 2
unload frm...(your from name)
end select
If Forms![Data Entry Form]![Site Walkover Flag] = -1 Then
DoCmd.OpenForm "Walkover2"
DoCmd.GoToRecord acDataForm, "Walkover2", acGoTo, [Forms]![Data Entry Form]![ID]
Else
DoCmd.OpenForm "Walkover"
DoCmd.GoToRecord acDataForm, "Walkover", acGoTo, [Forms]![Data Entry Form]![ID]
End If
End Sub
Display More
before you call the macro depending from which form you call it:
Re: Close Active Form Vb Query
You can solve this with a public integer:
Example:
When you load the macro from form1:
When you load the macro from form2:
Then in your macro:
Hope this helps.
Re: Adding Data To A Separate Worksheet
Glad I could help
Re: Sql Query Based On Spreadsheet Cell
Hi, small remark. If the `DB`.Rno-field of your database is a number-type(see design of your table) you don't have to use '.
For a number:
For a text-field(See DaveR's example)
Re: List The Worksheets In A Workbook
You can use a macro to accomplish this:
Dim objSheet As Object
Dim intRow As Integer
Set objSheet = Excel.Sheets
intRow = 1 'Start writing result on row 1
For Each objSheet In ActiveWorkbook.Sheets
Sheets("Sheet1").Range("A" & intRow).Value = objSheet.Name
intRow = intRow + 1
Next
This codes writes the result on sheet "Sheet1" starting on row1, you can adapt the code using the sheet and starting row you want.
Re: Upload Userform Data To Database
Now I see it,
you have to do an addnew and update for every record:
...
.AddNew
.Fields("Date") = Me.TBM.Text & "/ " & Me.TBD.Text & "/ " & Me.TBY.Text
.Fields("Energy_Prod") = "NG"
.Fields("PRICE") = Me.TBNG.Value
.update
.AddNew
.Fields("Date") = Me.TBM.Text & "/ " & Me.TBD.Text & "/ " & Me.TBY.Text
.Fields("Energy_Prod") = "OIL"
.Fields("PRICE") = Me.TBOIL.Value
.update
.AddNew
.Fields("Date") = Me.TBM.Text & "/ " & Me.TBD.Text & "/ " & Me.TBY.Text
.Fields("Energy_Prod") = "EROCT"
.Fields("PRICE") = Me.TBERCOT.Value
.update
.AddNew
.Fields("Date") = Me.TBM.Text & "/ " & Me.TBD.Text & "/ " & Me.TBY.Text
.Fields("Energy_Prod") = "CINERGY"
.Fields("PRICE") = Me.TBCIN.Value
.update
.AddNew
.Fields("Date") = Me.TBM.Text & "/ " & Me.TBD.Text & "/ " & Me.TBY.Text
.Fields("Energy_Prod") = "PJM_WEST"
.Fields("PRICE") = Me.TBPJM.Value
.update
.AddNew
.Fields("Date") = Me.TBM.Text & "/ " & Me.TBD.Text & "/ " & Me.TBY.Text
.Fields("Energy_Prod") = "SP_15"
.Fields("PRICE") = Me.TBSP15.Value
.Update
...
Display More
Re: Saving An Unopened Workbook In A New Folder
Hi,
a possible solution could be using an API.
Here's an example of the CopyFile-API:
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Private Sub CommandButton1_Click()
Dim lngDummy As Long
Dim lngStat As Long
lngDummy = CopyFile("c:\test.txt", "c:\tmp\test.txt", lngStat)
End Sub
Hope this is what you seek.
Re: Upload Userform Data To Database
Hi,
everything looks ok according to me. Do you get an error message, if not I don't see the problem.
Re: Avoiding A Save Conflict?
Perhaps this thread helps: