We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
MS Access 2003 Help
xlt_hunter
Posts: 510 Forumite
in Techie Stuff
I have having a spot of trouble designing a new access database here and would like some help from any one with MS Access know how, I have 2 problems and they have both been spit into 2 parts below. I would be grateful for any help with these.
Part I
How do I get a query to repeat itself to gernerate extra rows of info into a report?.
I have "[Enter Ingredient Code]" in the criteria section on one column of the query, this gives me a popup when starting the report to enter the Ingredient code. I would like to have this reappear to enter more information onto the report. Maybe the action to with another pop up box like
"Would you like to add another ingredient"
"Yes" "No" (If no is clicked then run the report into print preview)
Click on yes and the query will rerun and enter the data in, select no and the report is made.
But I am lost on how to do this (very limited knowledge of Access)
Part II
I am having a little spot of trouble with this code:
For somereason, the PrintOut function to the printer is no longer working (it did the other day)
Where is it going wrong?
Many thanks
Mike
Part I
How do I get a query to repeat itself to gernerate extra rows of info into a report?.
I have "[Enter Ingredient Code]" in the criteria section on one column of the query, this gives me a popup when starting the report to enter the Ingredient code. I would like to have this reappear to enter more information onto the report. Maybe the action to with another pop up box like
"Would you like to add another ingredient"
"Yes" "No" (If no is clicked then run the report into print preview)
Click on yes and the query will rerun and enter the data in, select no and the report is made.
But I am lost on how to do this (very limited knowledge of Access)
Part II
I am having a little spot of trouble with this code:
Private Sub cmdSend_Click()
If Me.Dirty Then
If MsgBox("Record has not been saved. " & Chr(13) & _
"Do you want to save it?", vbInformation + vbOKCancel) = vbOK Then
DoCmd.RunCommand acCmdSaveRecord
Else
Exit Sub
End If
End If
' Create a Word document from template.
Dim WordApp As Word.Application
Dim strTemplateLocation As String
' Specify location of template
strTemplateLocation = "C:\MailMerge\SSA.dot"
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordApp = CreateObject("Word.Application")
End If
On Error GoTo ErrHandler
WordApp.Visible = True
WordApp.WindowState = wdWindowStateMaximize
WordApp.Documents.Add Template:=strTemplateLocation, NewTemplate:=False
' Replace each bookmark with field contents.
With WordApp.Selection
.Goto what:=wdGoToBookmark, Name:="FirstName"
.TypeText ([FirstName])
.Goto what:=wdGoToBookmark, Name:="Name"
.TypeText [FirstName]
.Goto what:=wdGoToBookmark, Name:="Supplier"
.TypeText [Supplier]
.Goto what:=wdGoToBookmark, Name:="Address"
.TypeText [Address]
.Goto what:=wdGoToBookmark, Name:="City"
If IsNull(City) Then
.EndOf Unit:=wdParagraph, Extend:=wdExtend
.TypeBackspace
Else
.TypeText [City]
End If
.Goto what:=wdGoToBookmark, Name:="State"
If IsNull(State) Then
.EndOf Unit:=wdParagraph, Extend:=wdExtend
.TypeBackspace
Else
.TypeText [State]
End If
.Goto what:=wdGoToBookmark, Name:="Postcode"
If IsNull(PostCode) Then
.EndOf Unit:=wdParagraph, Extend:=wdExtend
.TypeBackspace
Else
.TypeText [PostCode]
End If
.Goto what:=wdGoToBookmark, Name:="Country"
' If recipient in own country, no need to state country in letter.
If IsNull(Country) Or Country = "United Kingdom" Then
.EndOf Unit:=wdParagraph, Extend:=wdExtend
.TypeBackspace
Else
.TypeText [Country]
End If
.Goto what:=wdGoToBookmark, Name:="Name"
.TypeText [FirstName]
End With
DoEvents
WordApp.Activate
WordApp.PrintOut
Set WordApp = Nothing
Exit Sub
ErrHandler:
Set WordApp = Nothing
End Sub
For somereason, the PrintOut function to the printer is no longer working (it did the other day)
Where is it going wrong?
Many thanks
Mike
0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 352.5K Banking & Borrowing
- 253.7K Reduce Debt & Boost Income
- 454.5K Spending & Discounts
- 245.5K Work, Benefits & Business
- 601.4K Mortgages, Homes & Bills
- 177.6K Life & Family
- 259.4K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards